20,359
社区成员
发帖
与我相关
我的任务
分享
function httpRequest($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "Host: btso.pw";
$header[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0";
$header[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
$header[] = "Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2";
$header[] = "Connection: keep-alive";
$header[] = "Upgrade-Insecure-Requests: 1";
$header[] = "If-Modified-Since: Mon, 22 Oct 2018 02:57:41 GMT";
$header[] = "Cache-Control: max-age=0, no-cache";
$header[] = "Pragma: no-cache";
$user_agent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0";
curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
echo httpRequest('https://btso.pw/search/123');