"", "">
当前位置:Gxlcms > PHP教程 > phphttp请求数据

phphttp请求数据

时间:2021-07-01 10:21:17 帮助过:6人阅读

$url = 'https://......'; //请求地址

$ref_url = ''//来源页面

$data = array( //提交的数据

"param" => "",

"param" => ""

);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_USERAGENT, $agent);

curl_setopt($ch, CURLOPT_REFERER, $ref_url);

curl_setopt($ch, CURLOPT_POST, TRUE); //以POST方式提交

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

curl_setopt($ch, CURLOPT_TIMEOUT, 30); //超时时间

$contents = curl_exec($ch); //执行并获取返回数据

curl_close($ch);

var_dump($contents);

人气教程排行