0

嗨,我正在尝试创建一个 php 脚本来登录我的 tesco 帐户,但由于某种原因,cookie 无法正常工作,请帮助这里是我的脚本以及下面的脚本示例,以便您查看。

检查它不起作用

<?php
$url = "https://secure.tesco.com/register/default.aspx?vstore=0";
//
$h = curl_init();
curl_setopt($h, CURLOPT_URL, $url); 
curl_setopt($h, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($h, CURLOPT_POST, true);
curl_setopt($h, CURLOPT_POSTFIELDS, "form=fSignin&from=https%3A%2F%2Fsecure.tesco.com%2Fclubcard%2Fmyaccount%2Fhome.aspx&formData=bmV3UmVnPWZhbHNlJg%3D%3D&loginID=test%40hotmail.com&password=test&seamlesswebtag=&confirm-signin.x=47&confirm-signin.y=18");
curl_setopt($h, CURLOPT_HEADER, true);
curl_setopt($h, CURLOPT_RETURNTRANSFER, true);
curl_setopt($h, CURLOPT_COOKIE, 'tmpfile.tmp');
curl_setopt($h, CURLOPT_COOKIEJAR, 'tmpfile.tmp');
curl_setopt($h, CURLOPT_COOKIEFILE, 'tmpfile.tmp');
//
$result = curl_exec($h);
echo $result;
?>

有人可以帮我解决这个问题,以便它正确获取和使用 cookie

4

1 回答 1

1

你不需要这条线

curl_setopt($h, CURLOPT_COOKIE, 'tmpfile.tmp');

尝试删除它,如果仍然有问题,请尝试创建 tmpfile.tmp 并将 chmod 设置为 777。

于 2013-04-24T20:57:25.483 回答