Created
November 6, 2015 13:04
-
-
Save pavarotti305/33548256a306aaf992db to your computer and use it in GitHub Desktop.
Resolve Cpatcha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problems first where can I place this Script and if there are error