Jump to content

adentone

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by adentone

  1. Do I need to set some special headers or something? I really need help on this ASAP. Thank you!!!
  2. I am creating this feature for a client of mine that needs it working by tomorrow! I am trying to use cURL to grab the RSS feed here: http://blogs.menshealth.com/fitness-pros/feed But all I get back is an empty string... Please help - I've been searching Google & this forum but haven't found anything that I can use that fixes this issue. $feed = getRssData(); echo "<pre>\n"; print_r( $feed ); echo "\n</pre>\n"; function getRssData() { // returns the feed array $requested_feed = "http://blogs.menshealth.com/fitness-pros/feed"; $ch = curl_init($requested_feed); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); $rss_data = curl_exec($ch); curl_close($ch); echo "RSS DATA: <br />\n" . $rss_data; $doc = new DOMDocument(); $doc->load($rss_data); $arrFeeds = array(); foreach ($doc->getElementsByTagName('item') as $node) { $itemRSS = array ( 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue ); array_push($arrFeeds, $itemRSS); } return $arrFeeds; } You can see a live test here: http://pro-formpt.com/get_rss.php?feed=workout It only has a few parameters in it so I can use the same file to grab other RSS Feeds as well - but they all fail the same way. Like this one: http://pro-formpt.com/get_rss.php?feed=living Which should grab the feed from here: http://blogs.menshealth.com/mh-life/feed I truly appreciate any suggestions! Thanks!
×
×
  • 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.