CURL and HTTPS, “Cannot resolve host”

前端 未结 11 1955
时光取名叫无心
时光取名叫无心 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:09

    Your getting the error because you're probably doing it on your Local server environment. You need to skip the certificates check when the cURL call is made. For that just add the following options

    curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($c, CURLOPT_SSL_VERIFYHOST,  0);
    

提交回复
热议问题