Jump to content
xisto Community
Sign in to follow this  
rw4dmin

Automatic Login Using Curl

Recommended Posts

If you'are lazy people like me. This script may help u. This script is to automated our login to some site.
You must have cURL installed to use this script.

<?php// INIT CURL$ch = curl_init();// SET URL FOR THE POST FORM LOGINcurl_setopt($ch, CURLOPT_URL, 'http://http://ww1.external-site.com/rg-erdr.php?_rpo=t ENABLE HTTP POSTcurl_setopt ($ch, CURLOPT_POST, 1);// SET POST PARAMETERS : FORM VALUES FOR EACH FIELDcurl_setopt ($ch, CURLOPT_POSTFIELDS, 'fieldname1=fieldvalue1&fieldname2=fieldvalue2');// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIEScurl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');# Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL# not to print out the results of its query.# Instead, it will return the results as a string return value# from curl_exec() instead of the usual true/false.curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);// EXECUTE 1st REQUEST (FORM LOGIN)$store = curl_exec ($ch);// SET FILE TO DOWNLOADcurl_setopt($ch, CURLOPT_URL, 'http://http://ww1.external-site.com/rg-erdr.php?_rpo=t EXECUTE 2nd REQUEST (FILE DOWNLOAD)$content = curl_exec ($ch);// CLOSE CURLcurl_close ($ch); ?>

Share this post


Link to post
Share on other sites

Well done. I used this script to reverse engineer dynamic daily emails on my website in conjuction with jetable.Org to avoid getting spammed. Thanks! :D-Cliff Bennett

Share this post


Link to post
Share on other sites

Great Stuff

Automatic Login Using Curl

 

Wow, I've been through so many examples recently trying to login via curl and submit data to a database but could not get it to work due to cookies etc but this worked like a charm! I just wish I'd found your example 6-7 hours ago!! Thank you!

 

-reply by denise

Share this post


Link to post
Share on other sites

AHA! youve answered a question i couldnt be bothered to ask!I needed to login to a page with a GET var to the page i want, then be redirected to the page i want (now logged in) and decrypt some text and i was getting stuck at sending POST vars but now it may be solved!Thanks!Nice code too :lol: Good use of comments!

Share this post


Link to post
Share on other sites
Username/PasswordAutomatic Login Using Curl

How do I designate a username and password to use in the Automatic Login Using cURL script?

Share this post


Link to post
Share on other sites
Great Code - Thanks!Automatic Login Using Curl

Thanks for the great code it was exactly what I needed to automate the crediting on my site for those annoying affiliate networks that refuse to use postback URLs!  It couldn't have been more customized to fit my needs!

Regards,Tom Guilleaume

Share this post


Link to post
Share on other sites
Clear Example Of Curl.Automatic Login Using Curl

This was my first time attempting Curl and with your concept it made it easy to understand. Thank you for your post with the code.

-feedback by Mark

Share this post


Link to post
Share on other sites

hey,Thanks for script you wrote.It works for some system.For some system I receive message "Object moved to here.".Can you suggest me what could be the reason for this?-reply by vishal

Share this post


Link to post
Share on other sites
didnAutomatic Login Using Curl

 hi, the CURL script didn't word on nginx http server, anyone know how to fix this ? the nginx return 404 response (not found)

Thanks  

-reply by sapta

Share this post


Link to post
Share on other sites
Regarding automatic login using curlAutomatic Login Using Curl

Hi there,

whether cookie file path inclusion is compulsory or not..?

Thanks,

Ars

Share this post


Link to post
Share on other sites
curl auto login with webdav serverAutomatic Login Using Curl

Hi, I would like to know the possibilities to use the above script for WEBDAV log in.

Webdav will ask for windows authentication. Can we override this using curl.

Thanks in advance!!

Vijay

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.