0
我想製作一個使用curl提交表單的php腳本。 我見過這方面的其他問題,並tryed像其他的答案,但我得到了相同的結果Php curl不提交表格
我有一個簡單的表格,呼應submited
<form action="form.php" method="GET">
<input type="text" name="name"/>
<input type="submit">
</form>
<?PHP
if (! empty($_GET['name'])){
echo 'Hello, ' . $_GET['name'];
}
?>
,這裏的值是捲曲腳本
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.mydom.com/form.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'name' => 'Aname',
'submit' => 'submit'
));
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
echo "$result";
回送的結果就是沒有「你好&提交的值」
你的'捲曲'正在使用POST,但你的表單正在等待GET – andrewsi 2013-04-09 16:06:13
除了每個人都指出的那個之外,一切似乎都很好。嘗試$ _POST而不是$ _GET – acpmasquerade 2013-04-09 16:18:30