title: Automatically submitting a form with PHP Snoopy
body: <p>I am using the following code to automatically fill in a field and submit a form at another server:</p>
  
  <pre><code>&lt;?php   
      include "Snoopy.class.php";
      $snoopy = new Snoopy;      
      $snoopy-&gt;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-&gt;referer = "http://www.google.com/";
      $url = "http://example.com/?page=a";
      $data["field_name"] = "value";
      $snoopy-&gt;httpmethod = "POST";
      $snoopy-&gt;submit($url, $data);
      echo $snoopy-&gt;results;
  ?&gt; 
  </code></pre>
  
  <p>The problem is that it does not work!</p>
  
  <p>The source of the page <a href="http://example.com/?page=a" rel="nofollow">http://example.com/?page=a</a> is:</p>
  
  <pre><code>&lt;form action="" method="post" class="horizontal-form" role="form" &gt;
  &lt;input type="hidden" name="submit_form" value="true" /&gt;
  &lt;input type="text" name="field_name" class="form-control" value="" &gt;
  &lt;button type="submit" class="btn"&gt;&lt;i class="icon-ok"&gt;&lt;/i&gt; Send&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Any idea how it can be fixed?
  Can it be that the "action" in the main page is empty?</p>
  
  <p>Thank you for your help.</p>