问题
I have to create a bot to collect some data from my college website , it uses simeple login with regno and captcha fields , they dont use real captcha , its a fake one ( can be seen in page source ) . So my idea is to use a DOM Parser and fetch it from eg
Im a using PHP-Curl to do this job . My Code:`
<?
$ch = curl_init();
$captch = i will get the value from DOM Parser ( But here is the problem , i have to get it before even executing the page !! )
$fields = "regno=11BTA00&captcha=$captcha";
curl_setopt($ch,CURLOPT_URL,$loginurl);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields);
$data = curl_exec($ch);
curl_close($ch);
?>
The Problems is once i run curl_exec , get captca by parsing , to submit it i need to curl_exec again which leads to reloading of captcha ..
Any workaround for this ? other than cURL ? Im ready to use another library
来源:https://stackoverflow.com/questions/10926604/curl-submitting-post-fields-after-page-load-curl-exec