Jump to content

parsing feedburner rss feed with simplexml


defeated

Recommended Posts

Hi,

I've run into a problem, or rather users of the ap I'm developing are likely to run into a problem.

 

I'm using simplexml with curl to parse RSS feeds.  Mostly that works just fine.

 

The trouble I've run into is that if a user is using feedburner.  If they enter the feedburner url (http://feeds2.feedburner.com/blah) when asked for the feed they want parsed it is not a problem.

 

If however they give the original feed url (http://mysite/feed) then the parser cannot load the feed.

 

The relevant code is:

$settings['feed-url']='http://mysite/feed';

//Fetch the RSS feed
$ch = curl_init( $settings['feed-url'] );
if(!($ch)) echo "Could not initialise feed";
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if(!$feed = simplexml_load_string ( curl_exec($ch) )) echo "Could not load feed ".$settings ['feed-url'];
curl_close($ch);

 

That will result in the message displayed being "Could not load feed http://mysite/feed".

If I switched the feed to be http://feeds2.feedburner.com/blah then it would work perfectly.

 

I could tell people to just use their feedburner address, but it would be better if they could put in either.  My browser can handle it, so my ap should be able to handle it too.

 

Any ideas?  I can't find this problem mentioned anywhere.  :shrug:

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.