Skip to content



The problem is that, when I want to get captcha solution from url server (  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.

$fields = array(
            'file' => 'path/captcha.jpg',
            'source_url' => '',
            'captcha_platform' => '',
            'action' => 'Submit'

        $c = curl_init();
        curl_setopt($c, CURLOPT_URL, '');
        curl_setopt($c, CURLOPT_POST, 1);
        curl_setopt($c, CURLOPT_POSTFIELDS, $fields);
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
        $result = curl_exec($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]);


  • SvenSven
    Did you resolve the "file" stuff correctly? Use WireShark to debug this. Im sure you will see the mistake.
  • Since php 5.5 you have to use

    'file' => new CurlFile('path/captcha.jpg')

    instead of

    'file' => '@path/captcha.jpg'

    It's explained here :
  • exzajungexzajung thailand
    function breakcap($file){
        $fields = array(
        'file' => '@'.realpath('cap/'.$file),
        'source_url' => '',
        'captcha_platform' => '',
        'action' => 'Submit'
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, '');
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $result = curl_exec ($ch);
        curl_close ($ch);
        preg_match('/<span id="captcha_result">(.*)<\/span>/', $result, $matches);
        return $matches[1];
  • SvenSven
    thanks @exzajung
  • Is it possible to send request to remote system where this software is installed and get the result.
  • SvenSven
    for what reason?
  • We are running our service in linux environment. With some script here maybe the above php code I would like to send the captcha image to the one of the machine (which is running in windows) where the software is installed and get the response (solved captcha text).
  • SvenSven
    As interface you have to choose inside CB. Then on your linux system you have to connect to the external IP on the server where CB runs.
  • Thanks for you reply.

    When I try to connect to remote system. I'm getting the requested URL for not found.

    PS : the ip is set to remote host external ip address
  • SvenSven
    Then check your firewall on that server...something might block it.
Sign In or Register to comment.