问题在于,当我想通过手动选择并提交文件(captcha.jpg)从url服务器(http://127.0.0.1/gsa_test.gsa)获取验证码解决方案时,程序会返回解决方案,但是当我想要使用php中的代码,程序返回" [无法破解验证码,对不起]" 文件夹的路径肯定是好的。
链接到验证码:http://www.megafileupload.com/rB5R/captcha.jpg
代码:
$fields = array(
'file' => 'path/captcha.jpg',
'source_url' => '',
'captcha_platform' => '',
'action' => 'Submit'
);
$c = curl_init();
curl_setopt($c, CURLOPT_URL, '127.0.0.1/gsa_test.gsa');
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, $fields);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($c);
curl_close($c);
$in = $result;
preg_match_all('#<html><head><title>GSA CB Result</title></head><body><h1>The solution is :: (.*)</h1></body></html>#Us', $in, $out, PREG_PATTERN_ORDER);
$out = implode($out[1]);
debug($out);