file_get_contents 获取不到内容,别的函数替代
展开阅读全文

file_get_contents 获取不到内容,用curl方法

$url = "链接";//get 请求
$oCurl = curl_init();
if(stripos($url,"https://")!==FALSE){
	curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);

	curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE);

	curl_setopt($oCurl, CURLOPT_SSLVERSION, 1);
}

curl_setopt($oCurl, CURLOPT_URL, $url);

curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );

$sContent = curl_exec($oCurl);

$aStatus = curl_getinfo($oCurl);

curl_close($oCurl);

return $sContent;