note 88615 added to function.simplexml-load-file

From: Date: Sat, 31 Jan 2009 20:30:46 +0000
Subject: note 88615 added to function.simplexml-load-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-150047@lists.php.net to get a copy of this message
This function gets RSS Items of a Wordpress blog from a search and fills the respective elements into an array: <?php function get_rss_items($searchkeywords) { // define url $url = "http://some.wordpress.blog.com/feed/?s=" . urlencode($searchkeywords) . "&submit="; // retrieve search results if($xml = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA)) { $result["title"] = $xml->xpath("/rss/channel/item/title"); $result["link"] = $xml->xpath("/rss/channel/item/link"); $result["content"] = $xml->xpath("/rss/channel/item/content:encoded/text()"); foreach($result as $key => $attribute) { $i=0; foreach($attribute as $element) { $ret[$i][$key] = (string)$element; $i++; } } return $ret; } else return false; } ?> ---- Server IP: 92.48.74.199 Probable Submitter: 78.105.21.182 ---- Manual Page -- http://www.php.net/manual/en/function.simplexml-load-file.php Edit -- https://master.php.net/note/edit/88615 Del: integrated -- https://master.php.net/note/delete/88615/integrated Del: useless -- https://master.php.net/note/delete/88615/useless Del: bad code -- https://master.php.net/note/delete/88615/bad+code Del: spam -- https://master.php.net/note/delete/88615/spam Del: non-english -- https://master.php.net/note/delete/88615/non-english Del: in docs -- https://master.php.net/note/delete/88615/in+docs Del: other reasons-- https://master.php.net/note/delete/88615 Reject -- https://master.php.net/note/reject/88615 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#150047) next »