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 ?

Samuel De Backer
  • 3,404
  • 2
  • 26
  • 37
  • Hm, this question confused me, and I copy-pasted your code and executed script - page content returned. Probably there's something wrong with your network configuration or php configuration? – Kel Oct 24 '10 at 16:22

1 Answers1

1

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.

Jim
  • 18,673
  • 5
  • 49
  • 65