0

curl スクリプトが正しく動作することはわかっています。電子メールをハードコードしてcurlに渡すと正常に動作しますが、入力するphpスクリプトを作成しようとしていますが、動作しません。以下にリンクとコードを掲載します。入力 email@ccc.com:passss を使用しています。

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

2 に答える 2

0

フィールドに値属性を与えてみてください

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

また、提供されたコードから送信ボタンがありません

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

最後に、cURL 要求でユーザーメールとパスワードのパラメーターを URL エンコードする必要があります。

于 2013-04-25T22:53:22.337 に答える