自动填充另一个网站的表单并发送 [英] Autofill a form of another website and send it

查看:146
本文介绍了自动填充另一个网站的表单并发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了网络,没有发现任何东西。

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。我搜索了CURL的示例,但没有发现任何东西。

I don't wanna give this to the URL like "?myvar=test&myvar2=test2". I searched for examples for CURL, but found nothing.

我只需要填写表单,发送它,并获得源代码。

I only want fill the form, send it, and get the source code. Or is there an addon for firefox or a free program?

最好的问候
KalTo

With best regards KalTo

推荐答案

您需要查看表单操作属性。这应该指向你的表单发布到的脚本。当您有这些信息时,您可以使用curl或在php中发送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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆