BREAKING CAPTCHA WITH PHP PROBLEM
lukasz666
Poland
Hi.
The problem is that, when I want to get captcha solution from url server (http://127.0.0.1/gsa_test.gsa) by hand choosing and submiting file (captcha.jpg), the program returns solution, but when i want to do it with code in php, program returns "[unable to break captcha, sorry]"
Path to folder is good for sure.
link to captcha: http://www.megafileupload.com/rB5R/captcha.jpg
Code:
$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);
Comments
'file' => new CurlFile('path/captcha.jpg')
instead of
'file' => '@path/captcha.jpg'
It's explained here : https://wiki.php.net/rfc/curl-file-upload