我在网上搜索了一无所获。
网站上有一个电子邮件地址输入框。我想用电子邮件地址填写此字段并发送表格。然后我将从网站上获取完整的源代码。
我不想想将其提供给像“?myvar=test&myvar2=test2”这样的URL。我搜索了 CURL 的示例,但没有找到任何结果。
我只想填写表格、发送并获取源代码。或者有 Firefox 插件或免费程序吗?
致以诚挚的问候 卡尔托
最佳答案
您将需要查看表单操作属性。这应该将您指向表单发布到的脚本。当您获得该信息后,您可以使用curl 或在php 中向该url 发送POST 请求,
$postdata = http_build_query(
array(
'email' => 'youremailaddress'
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents('http://example.com/submit.php', false, $context);
关于php - 自动填写另一个网站的表格并发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6787872/