gimme4free
Elite Member
- Oct 22, 2008
- 1,935
- 1,989
Does Anyone Have An Example Of A PHP Script That Has Integrated The Decaptcher API?
I am pretty sure that I read that the speed is 10 seconds and can be up to 30 seconds. I found this example on this forum but I have not tested it yet. I updated the poster URL to the latest one and will be trying it out soon:Actually, possibly soon. I was actually just looking into this service to see if i could find out the speed of the results received back.
I do plan on using php to access it so it is possible in the next day i will toss together a quick example just to test how they handle it. if i do, i'll toss it up here for everyone to see
<?php
Function Curlypost ($address, $postdata)
{
$reffer = $address;
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
$cookie_file_path = "cookie.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $address);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
Function RecogniseCaptcha ($username, $password, $filename)
{
$postData = array();
$postData[ 'function' ] = "picture2";
$postData[ 'username' ] = "$username";
$postData[ 'password' ] = "$password";
$postData[ 'pict_to' ] = "0";
$postData[ 'pict_type' ] = "0";
$postData[ 'pict' ] = '@'.realpath("$filename");
$postData[ 'submit' ] = "Send";
$data = curlypost ("http://poster.decaptcher.com/", $postData);
$pieces = explode ("|", $data);
return $pieces [5];
}
echo RecogniseCaptcha ("username", "password", "pic.jpg");
?>
$post = array("function" => "picture2",
"username" => D_USER,
"password" => D_PASS,
"pict" => "@captcha_img.png",
"pict_to" => 0,
"pict_type" => 82
);
$captchaurl = "http://poster.decaptcher.com/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$captchaurl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postit);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$captchastring = curl_exec ($ch);
unset($ch);
$d = explode('|', $captchastring);
$dresult = $d[0];
$dmajor = $d[1];
$dminor = $d[2];
$dtype = $d[3];
$dtimeout = $d[4];
$captcha = $d[5]; //CAPTCHA STRING