PHP cURL get content with accented URL
Using cURL with an accented URL, I cannot get content if CURLO开发者_高级运维PT_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 ?
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.
精彩评论