madblacker
Regular Member
- Nov 2, 2009
- 291
- 35
This is driving me crazy.. I have been doing a lot of work in php curl lately and have been able to make bots that successfully post to websites but in trying to use the Decaptcher POST method of submitting data I am just unable to get it to work... I would appreciate if anyone can help
############ This is the form example they give, I am able to use this successfully to manually return a captcha code from them #####
###########
#### Now when I try this within my PHP script I do not get the code back when I echo the result, I've spent probably 5 hours today on this and still nothing, I did mess around with the api and got one example from here to work but it was much slower than the post method so I really want to use POST #########
############ This is the form example they give, I am able to use this successfully to manually return a captcha code from them #####
Code:
<html>
<body>
<form
method="post"
action="http://poster.decaptcher.com/"
enctype="multipart/form-data">
<input type="hidden" name="function" value="picture2">
<input type="text" name="username" value="client">
<input type="text" name="password" value="qwerty">
<input type="file" name="pict">
<input type="text" name="pict_to" value="0">
<input type="text" name="pict_type" value="0">
<input type="submit" value="Send">
</form>
</body>
</html>
###########
#### Now when I try this within my PHP script I do not get the code back when I echo the result, I've spent probably 5 hours today on this and still nothing, I did mess around with the api and got one example from here to work but it was much slower than the post method so I really want to use POST #########
Code:
$jar = 'C:/Users/a/curlcookies/my_cookies.txt' ;
curl_setopt($curl_exec, CURLOPT_POST, 1);
curl_setopt($curl_exec, CURLOPT_HEADER, 1);
curl_setopt($curl_exec, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_exec, CURLOPT_COOKIEJAR, $jar);
curl_setopt($curl_exec, CURLOPT_COOKIEFILE, $jar);
curl_setopt($curl_exec, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_exec, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_exec, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1' ) ;
curl_setopt($curl_exec, CURLOPT_URL, "http://poster.decaptcher.com");
$decaptcher_string =
array(
'function'=>'picture2',
'username'=>'myuser' ,
'password'=>'mypass' ,
'file_contents'=>'@C:/wamp/www/decaptcher/image.jpg',
'pict_to'=>'0',
'pict_type'=>'0'
);
curl_setopt($curl_exec, CURLOPT_POSTFIELDS, $decaptcher_string);
$decaptcher_result = curl_exec($curl_exec);
echo $decaptcher_result ;