Skip to content

php code

Hi. Please, help me. I've not working with PHP, so I don't know why this code not working for me.

$captcha = file_get_contents('');
file_put_contents(__DIR__ . '/captcha.jpg', $captcha);

$fields = array(
    'file' => '@' . __DIR__ . '/captcha.jpg',
    '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);
echo $matches[1];
return $matches[1];

P.S. Sorry for my bad English.


Sign In or Register to comment.