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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.