stuck at php cURL captcha and headers:(

maximviper

BANNED
Joined
Oct 25, 2010
Messages
338
Reaction score
87
hello guys.

i m new to curl . m trying to automate some logins creation

but the website i m working with is having very complex headers,


captcha image is :

PHP:
recaptcha/api/image?c=03AHJ_Vusz08Qf9z_MKUOk71WEPCJkgEEzCeB_0c52qYmDTwN6p3eaLHfeik07_T8YwT022gA0dDmn82v8vLv8nnoQrAHXPco9ZI1oXGWiz0KlMD3ujrW7xaAnRL6aBQC4gkhrWaQltylcS5bhTofD9fQ5RG2cyfEjHQ" style="display:block;">
this is the header :
PHP:
Content-Length: 330
Cookie: __utma=235386264.1813212993.1297128520.1297399112.1297401711.6; __utmz=235386264.1297169093.2.2.utmcsr=iwebtool.com|utmccn=(referral)|utmcmd=referral|utmcct=/backlink_checker; __qca=P0-1432432680-1297128524399; __gads=ID=25425b210834a4ed:T=1297155652:S=ALNI_MbB7ucClkr3Oh3MLCkeeK1czQbLoQ; ru=%2create%2Fname%2F; rutxt=create%20a%20new%20bog.; __utmc=235386264; __utmb=235386264.1.10.1297401711
Pragma: no-cache
Cache-Control: no-cache
ajax=1&usname=goookokasd&usemail=goookokasd%40yahoo.com&password=mystery&password2=mystery&eula=on&recaptcha_challenge_field=03AHJ_VuuSnXX09zIJSmYjVo7OspRCgW8X12rEqkXkU7Xbof1wvku53H3jmBEfr90zD8eBWav3UkU4UfY2i-ISzYiEGMVw0ckhDJFvZErzIKbI-8LXVrE1pdpINWhQQ8MsLz4BHu9hfZmF5vhhg26jKEDpFh30bNf8_Q&recaptcha_response_field=edssss%201454
i ahve no clue how to mimic this kind of complex headers.
the tutorials i found have only simple headers.

can anone please suggest me a descent source where i can learn to create such kind of headers?
 
What you have posted here are headers coming from the servers, which you really don't have to worry about, you set your headers to mimic a regular browser.
 
You do know you just posted credentials for a site on here right
 
PHP:
/* STEP 2. visit the homepage to set the cookie properly */
$ch = curl_init ("http://somedomain.com/");
curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec ($ch);

/* STEP 3. visit cookiepage.php */
$ch = curl_init ("http://somedomain.com/cookiepage.php");
curl_setopt ($ch, CURLOPT_COOKIEFILE, $ckfile); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec ($ch);

That's some copy/paste to illustrate how to use cookies. The "cookiejar" file is the file where cookies get written to. The cookie file is the file that cookies are sent from. You can set these to the same file, so between multiple requests the cookies are taken care of for you.

Next the last line is the content that you're posting. To do this:

PHP:
curl_setopt($ch, CURLOPT_POST      ,1);
 curl_setopt($ch, CURLOPT_POSTFIELDS    ,$POSTVARS);

Where $postvars is a strings that looks exactly like the last line of your headers. in this line special characters must be url encoded. The email [email protected] turns into email%40aol.com. to do this: urlencode("[email protected]). You must set curlopt_post to 1 so it knows that it's sending a post request.

Lastly, the header you posted is in fact a valid request header. A response header would look different. One way you can tell is a request header may have a "Cookie: " field, whereas a response header may have a "Set-Cookie: " field.
 
ReCaptcha is a multi-step process, is that all you're having issues with? What you'll need to do is parse out the first link, which it appears you have. You'll need to hit that with cURL, parse out some additional information, and then hit the actual image URL.

Also, what you've posted does in fact have username/password for your e-mail. I'd change it if it has sensitive information.
 
Back
Top