记录一次PHP curl带cookie参请求
2022-07-28 15:09:43
102
{{single.collect_count}}
<?php header("Content-type:text/html;Charset=utf8");$ch =curl_init();curl_setopt($ch,CURLOPT_URL,'https://www.xxx.com/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;

 

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}