title: using php curl to extract data from a website with multiple submits
body: <p>I have to extract data from a website via multiple submits and this has to be done automatically... the flow is as follows...</p>
  
  <ol>
  <li>Go to this page...http://www.licindia.in/premium_calculator.htm.</li>
  <li>Select something and then submit it. This will take me to a form</li>
  <li>Fill up the form there and submit it...</li>
  <li>get the html that is produced. and extract data.</li>
  </ol>
  
  <p>I have used curl earlier to log into websites remotely but I cant seem to get this working anyway.</p>
  
  <pre><code>$url="http://www.licindia.in/premium_calculator.htm";
  $postdata = "thepostdata"
  $cookie = "cookie.txt" ;
  $ch = curl_init(); 
  curl_setopt ($ch, CURLOPT_URL, $url); 
  curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, true);
  curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0");
  curl_setopt($ch,CURLOPT_COOKIESESSION,false); 
  curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
  curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);  
  curl_setopt ($ch, CURLOPT_REFERER, $referer);
  curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
  curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
  curl_setopt ($ch, CURLOPT_POST, 1); 
  $result = curl_exec ($ch);
  curl_close($ch);
  </code></pre>
  
  <p>Something like this i have tried...this is not the actual thing..but this is similar</p>