2013-04-25 99 views
0

我知道我的捲曲腳本正常工作。我可以對電子郵件進行硬編碼並通過curl並且工作正常,但現在我正在嘗試創建一個php腳本來輸入它,但它不起作用。我將在下面發佈鏈接和代碼。 我正在使用輸入的[email protected]:passss。捲曲和PHP的HTML不記錄正確我知道捲曲函數工作

http://cyber-hosted.com/CH/index.html

<html> 
<head> 
</head> 
<body> 
<form action="n.php" method="post"> 
<input type="text" name="mail /> 
<input type="password" name="pass" /> 
</form> 
</body> 

http://cyber-hosted.com/CH/n.php

<?php 
$usermail = $_POST['Mail']; 
$pass = $_POST['pass']; 



$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=$usermail&password=$pass&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_COOKIEJAR, 'cookies.txt'); 
curl_setopt($h, CURLOPT_COOKIEFILE, 'cookies.txt'); 
curl_setopt($h, CURLOPT_FOLLOWLOCATION, true); 
// 
$result = curl_exec($h); 
echo $result; 
?> 

回答

1

你鍵入郵件大寫:

$usermail = $_POST['Mail']; 
//  here -----^ 

將其更改爲:

$usermail = $_POST['mail']; 

啊,我差點忘了雙引號的位置:

<input type="text" name="mail /> 
<!--   here --------^ ---> 

應該<input type="text" name="mail" />

+0

仍然不工作得到相同的錯誤 – 2013-04-25 22:41:42

+0

你會得到什麼錯誤? – HamZa 2013-04-25 22:42:03

+0

此頁面有2個錯誤。 「電子郵件地址」是必填項。您必須提供值 「密碼」是必需的項目。你必須提供一個值 – 2013-04-25 22:42:33

0

先給字段的值屬性

<input type="text" name="mail" value=""/> 
<input type="password" name="pass" value=""/> 

Als Ø你缺少從您提供的代碼

<input type="submit" name="submit" value="Submit"/> 

提交按鈕,最後你應該URL編碼的usermail和密碼參數捲曲請求。