views:

20

answers:

2

Using cURL with an accented URL, I cannot get content if CURLOPT_RETURNTRANSFER = true.

Example:

$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://fr.wikipedia.org/wiki/Été");
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, true);
$html = curl_exec ($curl);
echo $html;

$html is empty, does someone have a solution ?

A: 

Try using urlencode for the accent part of the url:

curl_setopt ($curl, CURLOPT_URL, "http://fr.wikipedia.org/wiki/" . urlencode("Été"));

And see what happens.

Brad F Jacobs
A: 

I discovered that the error was further in my script, thanks.

Samuel