php curl login and post to form
<p>I am making automated login to a member area using curl and login is successful. I am using following code.</p>

<pre><code>$main_url = 'https://www.url.com';

$redirect = '/reports/marks-checker';
$email =    'user@gmail.com'; 
$password = 'pass123'; 


$url= $main_url.'/account/login'; 
$cookie="cookie.txt"; 

$postdata = 'redirect='.$redirect.'&amp;EmailAddress='.$email.'&amp;Password='.$password.'&amp;RememberMe=1'; 

$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; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie); 
curl_setopt ($ch, CURLOPT_REFERER, $url); 

curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
curl_setopt ($ch, CURLOPT_POST, 1); 
$result = curl_exec ($ch); 
echo $result;

curl_close($ch);
</code></pre>

<p>above code prints(echo) member area and form(given below) which i want to query, now how to post to following form using curl again, i want yours help for that.</p>

<pre><code>&lt;form method="POST"&gt;
&lt;input type="radio" name="IDS" value="F" checked/&gt;
&lt;input type="radio" name="IDS" value="H"/&gt;
&lt;textarea name="q" cols="80" rows="15" wrap="none" style="width:99%"&gt;&lt;/textarea&gt;
&lt;select name="SortBy"&gt;
    &lt;option value="0"&gt;rank&lt;/option&gt;
    &lt;option value="1"&gt;date&lt;/option&gt;
&lt;/select&gt;
&lt;input type="submit" name="getmarks" value="Check marks"/&gt;
&lt;/form&gt;
</code></pre>

<p>I want to use above form after successful login so i can code it more and parse the results through regex. And i couldn't get answer for this when i have tagged it as curl thanks.</p>
