0

我必须创建一个机器人来从我的大学网站收集一些数据,它使用带有 regno 和验证码字段的简单登录,他们不使用真正的验证码,它是假的(可以在页面源代码中看到)。所以我的想法是使用 DOM Parser 并从例如

我使用 PHP-Curl 来完成这项工作。我的代码:`

<?
$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);
?>

问题是一旦我运行 curl_exec ,通过解析获取验证码,提交它我需要再次 curl_exec 导致重新加载验证码..

有什么解决方法吗?除了卷曲?我准备好使用另一个库

4

0 回答 0