Skip to Navigation

PHP5: Fetch an RSS/Atom feed

Its amazing how simple this task is using PHP5, cURL, and SimpleXML

   1:<?php
   2:$ch = curl_init();
   3:curl_setopt($ch, CURLOPT_URL, 'http://tech.forumone.com/atom.xml');
   4:curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   5:if ($output = curl_exec($ch))
   6:{
   7:    $xml = new SimpleXmlElement($output);
   8:}
   9:curl_close($ch);
  10:?>