php curl 获取 HTTPS

注意:谷歌的话开vpn可能才可以,goagent也不行
function getHTTPS($url) {
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($ch, CURLOPT_HEADER, false);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_REFERER, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  $result = curl_exec($ch);
  curl_close($ch);
  return $result;
}


$timeout=15;

curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
//curl_setopt($ch, CURLOPT_USERAGENT, 'googlebot');
//curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

posted @ 2015-09-01 20:15  也许明天  阅读(525)  评论(0编辑  收藏  举报