Php 自动表格填充
如果我有像这样的页面 xxxxxxx.org/2014/custom/code/code.php 还有一个文本字段和一个sumit按钮 它的表单标签如下所示Php 自动表格填充,php,html,curl,Php,Html,Curl,如果我有像这样的页面 xxxxxxx.org/2014/custom/code/code.php 还有一个文本字段和一个sumit按钮 它的表单标签如下所示 <form action="code.php" method="POST"> <p class="formtext"> Enter The Answer Here : <input type=text name="solution" /> <
<form action="code.php" method="POST">
<p class="formtext">
Enter The Answer Here : <input type=text name="solution" />
<input name="submit" type=submit class="btn btn-large btn-success" value="Submit" />
</p>
</form>
</div>
</html>
在此处输入答案:
因此,我需要的是使用curl将文本框的值传递给code.php
来自我的本地主机,但它不起作用:/
编辑:
curl php文件的内容是:
<?php
$name = "ASDF";
//$post = array(
// 'name' => urlencode($name),
//);
$post="solution=$name";
$ch =curl_init();
curl_setopt($ch, CURLOPT_URL , 'http://www.XXXXXXXX.org/2014/custom/code/code.php');
curl_setopt($ch,CURLOPT_POST ,TRUE ) ;
curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
echo $r = curl_exec($ch);
curl_close($ch);
?>
有人登录了吗
但是我已经手动登录了,然后我在浏览器中打开了curl.php文件,它再次将我带到登录页面,在我再次登录之后
curl将值传递给www.localhost/code.php
而不是实际卷曲后参数将为:
$post="solution=$name&submit=Submit";
您缺少的
submit=submit
使用的curl\u exec
功能php@Smash检查editTryecho curl\u错误($r)
并查看错误是什么。@AJReading不返回错误