使用PHP Snoopy自动提交表单

时间:2015-05-29 20:30:46

标签: php forms snoopy

我使用以下代码自动填写字段并在另一台服务器上提交表单:

<?php   
    include "Snoopy.class.php";
    $snoopy = new Snoopy;      
    $snoopy->agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 FirePHP/0.2.1";
    $snoopy->referer = "http://www.google.com/";
    $url = "http://example.com/?page=a";
    $data["field_name"] = "value";
    $snoopy->httpmethod = "POST";
    $snoopy->submit($url, $data);
    echo $snoopy->results;
?> 

问题是它不起作用!

页面来源http://example.com/?page=a是:

<form action="" method="post" class="horizontal-form" role="form" >
<input type="hidden" name="submit_form" value="true" />
<input type="text" name="field_name" class="form-control" value="" >
<button type="submit" class="btn"><i class="icon-ok"></i> Send</button>
</form>

知道如何解决这个问题吗? 这可能是&#34;行动&#34;在主页面是空的?

感谢您的帮助。

0 个答案:

没有答案