curl post方式访问网页

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

$url = http://xxxx.com;
 
$params = array('id'=>11,'aa'=>22,'cc'=>33);
 
$data = http_build_query($params);
 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if('' != $data){
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
 
curl_setopt($ch, CURLOPT_TIMEOUT, 6);
$result = curl_exec($ch);
var_dump(curl_error($ch));
curl_close($ch);
return $result;