note 84135 added to book.simplexml

From: Date: Mon, 30 Jun 2008 13:58:55 +0000
Subject: note 84135 added to book.simplexml
Groups: php.notes 
Request: Send a blank email to php-notes+get-141007@lists.php.net to get a copy of this message
Here are two quick and dirty functions that use SimpleXML to detect if a feed xml is RSS or ATOM: function is_rss($feedxml) { @$feed = new SimpleXMLElement($feedxml); if ($feed->channel->item) { return true; } else { return false; } } function is_atom($feedxml) { @$feed = new SimpleXMLElement($feedxml); if ($feed->entry) { return true; } else { return false; } } The functions take in the full text feed (retrieved via cURL, for example) and return a true or a false based on the result. ---- Server IP: 59.162.86.33 Probable Submitter: 60.254.53.224 ---- Manual Page -- http://www.php.net/manual/en/book.simplexml.php Edit -- https://master.php.net/note/edit/84135 Del: integrated -- https://master.php.net/note/delete/84135/integrated Del: useless -- https://master.php.net/note/delete/84135/useless Del: bad code -- https://master.php.net/note/delete/84135/bad+code Del: spam -- https://master.php.net/note/delete/84135/spam Del: non-english -- https://master.php.net/note/delete/84135/non-english Del: in docs -- https://master.php.net/note/delete/84135/in+docs Del: other reasons-- https://master.php.net/note/delete/84135 Reject -- https://master.php.net/note/reject/84135 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141007) next »