开发者

curl could not resolve host URL cut off

I'm getting a cURL error "Could not resolve host" and then it shows a cut 开发者_开发知识库off URL. The generated URL is fine, because when I enter it to the browser, it works.

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
if (!$result = curl_exec($ch))
{
    die ('Curl Error: '.curl_error($ch));
}
curl_close($ch);

Why does it do that?


I was encoding too much of the URL. One should not encode the host, just the parameters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜