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://decaptcher.com/poster/", $postData);
$pieces = explode ("|", $data);
return $pieces [5];
}
echo RecogniseCaptcha ("username", "password", "pic.jpg");