自动填写另一个网站的表格并发送 [英] Autofill a form of another website and send it
问题描述
我在网上搜索,一无所获.
I searched the web and found nothing.
在网站上,有一个电子邮件地址的输入框.我想用电子邮件地址填写此字段并发送表格.然后我会从网站上获取完整的源代码.
On the website, there is a Input box for a E-Mail address. I would like to fill this field with an e-mail address and the send the form. Then i will get the whole source code from the website.
我不想要将其提供给诸如?myvar=test&myvar2=test2"之类的 URL.我搜索了 CURL 的示例,但一无所获.
I don't wanna give this to the URL like "?myvar=test&myvar2=test2". I searched for examples for CURL, but found nothing.
我只想填写表格,发送它,然后获取源代码.或者是否有 Firefox 的插件或免费程序?
I only want fill the form, send it, and get the source code. Or is there an addon for firefox or a free program?
致以最诚挚的问候卡尔托
With best regards KalTo
推荐答案
您将需要查看表单操作属性.这应该将您指向表单发布到的脚本.当您拥有该信息时,您可以使用 curl 或在 php 中向该 url 发送 POST 请求,
You will need to look at the form action attribute. This should point you to the script the form is posted to. When you have that information you can send a POST request to that url using curl or when in php,
$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);
这篇关于自动填写另一个网站的表格并发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!