티스토리 뷰

<rss version="2.0">

<channel>

<title>Naver Open API</title>

<link>http://search.naver.com</link>

<description>Naver Search Result</description>

<lastBuildDate>Wed, 16 Apr</lastBuildDate>

<total>5455</total>

<start>1</start>

<display>2</display>

<item>

<title>asp가 무엇인가요</title>

<link>

http://openapi.naver.com/?asp

</link>

<description>

asp 는 active server page 입니다.

</description>

</item>

<item>

<title>jsp가 무엇인가요</title>

<link>

http://openapi.naver.com/?jsp

</link>

<description>

jsp 는 java server page 입니다.

</description>

</item>

</channel>
</rss>


<?php

$url="http://localhost/php_xml/naver.xml";



$response = file_get_contents($url);



$object = simplexml_load_string($response);

print_r($object);



$channel = $object->channel;



echo "total=".$channel->total;

echo "\n";



foreach ($channel->item as $value){

    $title=$value->title;

    echo "title=".$title;

    echo "\n";

    $link=$value->link;

    echo "link=".$link;

    echo "\n";

   

}



?>
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/12   »
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
글 보관함