views:

448

answers:

1

Hi!

I'm trying to do a CURL call to an RSS feed from a wordpress, I'm not using simplexml_load_file() because it's forbiden by php.ini to do such calls, so I'm trying to get the xml via CURL, so far it works for any URL but not for wordpress RSS feeds, even if they are on the same server.

If I access the Feed URL directly on my browser i can see the XML, but the server is failing, im trying the following

<?php
    $url = "http://www.legrandjournal.com.mx/category/actu-monde/feed/";

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);        
    $awel = curl_exec($ch);

    if($awel == false)
    {
     echo 'Curl error: ' . curl_error($ch);     
        echo "cookie";
    }

    //echo $awel;
    curl_close($ch);
    echo $awel;

?>

thanks in advance for any suggestion !

+2  A: 

try it without the last slash? : http://www.legrandjournal.com.mx/category/actu-monde/feed

ps: you should always use:

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

if you are not providing exact URL (e.g. using slash, where it isn't etc.)

dusoft
that was it ! ! thanks !
PERR0_HUNTER