2013-04-24 60 views
0

嗨,我想創建一個PHP腳本登錄到我的tesco帳戶,但由於某種原因,餅乾不工作請幫助這裏是我的腳本下面,也是我的腳本下面的例子,所以你可以檢查出來。捲曲腳本不正確使用餅乾

Check it out it does not work

<?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; 
?> 

可以someplease幫我解決這個問題,因此得到並使用餅乾正確

回答

1

你沒有,如果還需要這條線

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

嘗試刪除它,有一個問題,嘗試創建tmpfile.tmp並將chmod設置爲777.

+0

我已經得到那個工作n我有另一個錯誤訪問我的網站它說對象移動到這裏我點擊這裏,但沒有什麼 – 2013-04-24 21:00:55

+0

也許你應該設置CURLOPT_FOLLOWLOCATION,在這裏閱讀更多關於它http://php.net/manual/en/function.curl-setopt.php – nacholibre 2013-04-25 06:44:08