티스토리 뷰

반응형

14년 4월 기준.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

</head>

<body>

<?

include "XMLparse.php";

//$url = "http://www.zdnet.co.kr/Include2/ZDNetKorea_News.xml";

$url = "z.xml";

/*$curl = curl_init();

$timeout = 5;

curl_setopt($curl, CURLOPT_URL, $url);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);*/

//echo curl_exec($curl);

$xml = file_get_contents($url);

//$xml = curl_exec($curl);

$parser = new XMLParser($xml);

$parser->Parse();

$test = $parser->document;

echo "<a href=".$test->channel[0]->item[0]->link[0]->tagData." target='_blank'>"

.$test->channel[0]->item[0]->title[0]->tagData."</a>"."<br>";

echo $test->channel[0]->item[0]->description[0]->tagData."<br>";

echo $test->channel[0]->item[0]->category[0]->tagData."<br>";

echo $test->channel[0]->item[0]->pubDate[0]->tagData."<br>";

echo $test->channel[0]->item[0]->author[0]->tagData."<br>";

?>

</body>

</html>

 

 

반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함