CURL and HTTPS, “Cannot resolve host”

前端 未结 11 1975
时光取名叫无心
时光取名叫无心 2020-11-28 08:25

I\'m trying to fetch the contents of a page using CURL. The page that is doing the fetching is https and the page it is trying to fetch is also https. I\'m getting an erro

11条回答
  •  孤独总比滥情好
    2020-11-28 09:04

    Maybe a DNS issue?

    Try your URL against this code:

    $_h = curl_init();
    curl_setopt($_h, CURLOPT_HEADER, 1);
    curl_setopt($_h, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($_h, CURLOPT_HTTPGET, 1);
    curl_setopt($_h, CURLOPT_URL, 'YOUR_URL' );
    curl_setopt($_h, CURLOPT_DNS_USE_GLOBAL_CACHE, false );
    curl_setopt($_h, CURLOPT_DNS_CACHE_TIMEOUT, 2 );
    
    var_dump(curl_exec($_h));
    var_dump(curl_getinfo($_h));
    var_dump(curl_error($_h)); 
    

提交回复
热议问题