dongsi0625 2014-11-21 16:58
浏览 29
已采纳

Php Curl Cookie登录

Hi i need to login to webpage using cookie the cookie is in this format key=login value=id=3694385&pw=d9d51ab066c09c2404&cks=bfb964 Here is my code for login but it fails to login using this cookie.(Note cookie is constant for 24 hrs and i dont want to login using username and password)

Here is my code

<?php
$curl = curl_init('http://up.net/');
echo $curl;
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_COOKIE, 'login=id=3694385&pw=d9d51ab066c09c2404&cks=bfb964');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($curl);
curl_close($curl);
echo $page;
?>
  • 写回答

1条回答 默认 最新

  • duanrenchuo9244 2014-11-21 17:00
    关注

    your cookie format is wrong. Cookies are delimited by semicolons, not ampersands.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用