PHP 在cURL中伪造头信息

在cURL中伪造头信息


@header('Content-type:text/htmlcharset=utf-8');
//第一次初始化
$ch = curl_init();
curl_setopt($ch,CURLOPT,"http://xxxxx.com");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$h=array('HTTP_VIA:HTTP/1.1 SNXA-PS-WAP-GW21 (infox-WISG,Huawei Technologies)','HTTP_ACCEPT:application/vnd.wap.wmlscriptc,text/vnd.wap.wml,application/vnd.wap.xhtml+xml,application/xhtml+xml,text/html,multipart/mixed,*/*','HTTP_ACCEPT_CHARSET:ISO-8859-1,US-ASCII,UTF-8;Q=0.8;ISO-8859-15;q=0.8,ISO-10646-UCS-2;Q=0.6,UTF-1;Q=0.6');
curl_setopt($ch,CURLOPT_HTTPHEADER,$h);
$output = curl_exec($ch);
curl_close($ch);
//第二次跳转
$curl=curl_init();
curl_setopt($ch,CURLOPT_URL,"http://xxxxxxxxxx");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_HTTPHEADER,$h);
$output=curl_exec($ch);
curl_close($h);
var_dump($output);

你可能感兴趣的:(php,Http,curl,php)