Does anyone know what happen on the error as below when calling curl even call yahoo page:
Error code 6 :Couldn't resolve host 'http://www.yahoo.com'; No data of requested type
PHP
$sendurl = "http://www.yahoo.com";
$ch = curl_init($sendurl);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
$result = curl_exec($ch);
if(!$result){
echo $curl_errno($ch).":".curl_error($ch);
}
This error mean that curl can't resolve host name.
There is problem with DNS server on computer where you run this script.
If you run script on your local computer then check it just open www.yahoo.com in your browser.
If you run script on remote server, then you should login to server by SHH and check ping www.yahoo.com. Or ask your hosting support team about this issue.
I think you're missing options for allowing redirects and https. Check it in your browser -> you will get redirected to https URL.
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With