Created
November 27, 2011 16:55
-
-
Save netdesign/1397815 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $data = "http://feeds.feedburner.com/metroq?format=xml"; | |
| $ch = curl_init($data); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
| curl_setopt($ch, CURLOPT_POST, false); | |
| $result = curl_exec($ch); | |
| curl_close($ch); | |
| $xmlRawDoc = $result; | |
| $xmlDoc = new DOMDocument(); | |
| $xmlDoc->loadXML($xmlRawDoc); | |
| $xpath = new DOMXpath($xmlDoc); | |
| $elm = $xpath->query("*/item"); | |
| foreach($elm as $el){ | |
| #echo $el->child()->nodeName; | |
| $nodes = $el->childNodes; | |
| $tPath = new DOMXpath($nodes); | |
| $titles = $tPath->query("*/title"); | |
| foreach($titles as $title){ | |
| echo $title->nodeValue; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment