0

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 !

0

1 Answer 1

3

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.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.