<?php
header("Content-type:text/html;Charset=utf8");
$ch =curl_init();
curl_setopt($ch,CURLOPT_URL,'https://www.xxx/index.php');
$header = array();
//curl_setopt($ch,CURLOPT_POST,true);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER,true);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch,CURLOPT_COOKIE,'a=123; b=321;');
$content = curl_exec($ch);
echo "<pre>";print_r(curl_error($ch));echo "</pre>";
echo "<pre>";print_r(curl_getinfo($ch));echo "</pre>";
echo "<pre>";print_r($header);echo "</pre>";
echo "</br>",$content;
更多推荐
记录一次PHP curl带cookie参请求
发布评论