Jump to content

PHP 5 SimpleXML


april2008

Recommended Posts

I am trying to get .rss  working with the following url

 

http://www.studiolounge.net/2009/03/28/php-and-curl/

 

but i got this error Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 5: parser error : Opening and ending tag mismatch: META line 2 and HEAD in C:\Apache2.2\htdocs\emedia\twitter_rss3.php on line 16

 

currently using php5.0 and apache2.2

Link to comment
https://forums.phpfreaks.com/topic/161328-php-5-simplexml/
Share on other sites

this is the code i have

<?
    Function feedMe($feed) {  
        // Use cURL to fetch text  
        $ch = curl_init();  
        curl_setopt($ch, CURLOPT_URL, $feed);  
        curl_setopt($ch, CURLOPT_HEADER, 0);  
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);  
        $rss = curl_exec($ch);  
        curl_close($ch);  
     
       // Manipulate string into object  

       $rss = simplexml_load_string($rss);
  
   
     
       $siteTitle = $rss->channel->title;  
       echo "<h1>".$siteTitle."</h1>";  
       echo "<hr />";  
     
       $cnt = count($rss->channel->item);  
     
       for($i=0; $i<$cnt; $i++)  
       {  
           $url = $rss->channel->item[$i]->link;  
           $title = $rss->channel->item[$i]->title;  
           $desc = $rss->channel->item[$i]->description;  
           echo '<h3><a href="'.$url.'">'.$title.'</a></h3>'.$desc.'';  
       }  
   }  
     
   feedMe("http://twitter.com/statuses/user_timeline/44045750.rss");  
?>

Link to comment
https://forums.phpfreaks.com/topic/161328-php-5-simplexml/#findComment-851392
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.