CURL and HTTPS, “Cannot resolve host”

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

    You may have to enable the HTTPS part:

    curl_setopt($c, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($c, CURLOPT_SSL_VERIFYHOST,  2);
    

    And if you need to verify (authenticate yourself) you may need this too:

    curl_setopt($c, CURLOPT_USERPWD, 'username:password');
    

提交回复
热议问题