Skip to content

Instantly share code, notes, and snippets.

@pavarotti305
Created November 6, 2015 13:04
Show Gist options
  • Save pavarotti305/33548256a306aaf992db to your computer and use it in GitHub Desktop.
Save pavarotti305/33548256a306aaf992db to your computer and use it in GitHub Desktop.
Resolve Cpatcha
<?php
$useragent = 'Mozilla/41.0.2';
$url = 'http://lucien.com';
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($ch);
curl_close ($ch);
function submit_answer($response) {
$url = 'http://';
// get captcha
foreach(file($url) as $line) {
if (preg_match('/(.*) \<input.*captcha/',$line,$m))
$captcha=$m[1];
}
// solve captcha with this link contains the code that solve answer
$answer = file_get_contents('http://www.ditelkin.com/openanswers_solution/openanswers.php'.urlencode($captcha));
// submit the form
$data = array(
'result' => $response,
'captcha' => $answer);
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
@pavarotti305
Copy link
Author

Problems first where can I place this Script and if there are error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment