Skip to content

Instantly share code, notes, and snippets.

@techom
Created March 8, 2016 04:34
Show Gist options
  • Save techom/76f201b4a18604f17b1b to your computer and use it in GitHub Desktop.
Save techom/76f201b4a18604f17b1b to your computer and use it in GitHub Desktop.
curl 获取 https 内容的函数
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment