Reputation: 1570
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?
Upvotes: 0
Views: 1473
Reputation: 1570
I was encoding too much of the URL. One should not encode the host, just the parameters.
Upvotes: 1