当前位置 : 主页 > 网络编程 > PHP >

模拟get

来源:互联网 收集:自由互联 发布时间:2021-06-28
gistfile1.txt function getCurl ($url){$ch = curl_init();$header = ['Accept-Charset: utf-8'];curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($ch,
gistfile1.txt
function getCurl ($url)
	{
		$ch     = curl_init();
		$header = ['Accept-Charset: utf-8'];
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
		curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
		//curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		$temp = curl_exec($ch);
		$obj  = json_decode($temp, 1);

		return $obj;
	}
上一篇:压缩文件zip
下一篇:模拟post
网友评论