Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Automatic Login Using Curl


18 replies to this topic

#11 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 19 September 2009 - 11:16 AM

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

#12 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 14 November 2009 - 04:57 AM

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

#13 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 28 December 2009 - 05:13 AM

Regarding automatic login using curlAutomatic Login Using Curl

Hi there,

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

Thanks,

Ars



#14 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 16 March 2010 - 05:07 AM

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



#15 jhbalaji

    Newbie

  • Kontributors
  • Pip
  • 1 posts

Posted 18 May 2010 - 04:21 PM

Hey!
Where i need to insert the username and password :)

#16 Guest_Mr IvIeoh_*

  • Guests

Posted 07 April 2011 - 10:15 AM

View Postharrison858, on 29 October 2008 - 06:36 PM, said:

OMG! That was exactly what I was looking for, and it took me forever to find a script.
Thanks, now I will use it :)


>> Pls show me where is my errors in this code :

<?php
// INIT CURL
$ch = curl_init();

// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'http://www.vn-zoom.com/login.php?do=login');

// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);

// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'vb_login_username=meomunsocola&vb_login_password=t13h6x');

// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
curl_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 DOWNLOAD
curl_setopt($ch, CURLOPT_URL, 'http://www.external-site.com/Members/Downloads/AnnualReport.pdf');

// EXECUTE 2nd REQUEST (FILE DOWNLOAD)
$content = curl_exec ($ch);

// CLOSE CURL
curl_close ($ch); 

?>





#17 Guest_Gizmo_*

  • Guests

Posted 11 June 2011 - 12:10 PM

View PostMr IvIeoh, on 07 April 2011 - 10:15 AM, said:

>> Pls show me where is my errors in this code :

<?php
// INIT CURL
$ch = curl_init();

// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'http://www.vn-zoom.com/login.php?do=login');

// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);

// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'vb_login_username=meomunsocola&vb_login_password=t13h6x');

// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
curl_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);

[b]// SET FILE TO DOWNLOAD
curl_setopt($ch, CURLOPT_URL, 'http://www.external-site.com/Members/Downloads/AnnualReport.pdf');[/b]

// EXECUTE 2nd REQUEST (FILE DOWNLOAD)
$content = curl_exec ($ch);

// CLOSE CURL
curl_close ($ch); 

?>




Your error is in the download URL. Your trying to download a file from a page you haven't logged into ;)

#18 Guest_Mike_*

  • Guests

Posted 27 November 2011 - 09:34 AM

I am having getting the script to work, and I think it is due to my username. My username contains both the "@" and "." symbol.

For the "@" I understand I can use %40, however what is the value I should use for "."

the value i am trying to pass is email_name@domain.com

#19 Guest_kleinbaas_*

  • Guests

Posted 12 February 2012 - 07:56 PM

Hello. I have tried for two days to get this working, but I can't quite do it. Please help.

You can log into the site I want to get info from by going to this URL:
https://www.website....ord=123password

It then redirects you to the home page (https://www.website.com/)

This is the code I am using:

<?php
// INIT CURL
$ch = curl_init();
// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'https://www.website.com/website_update.php?task=login&');
// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);
// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'username=admin@othersite.com&password=123password');
// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
curl_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);
echo "store: " . $store . "<br />";
// SET FILE TO DOWNLOAD
curl_setopt($ch, CURLOPT_URL, 'http://www.website.com/stuff/morestuff/');
// EXECUTE 2nd REQUEST (FILE DOWNLOAD)
$content = curl_exec ($ch);
echo "content: " . $content . "<br />";
// CLOSE CURL
curl_close ($ch);
?>

The result is just a blank page (or store: content: with my 'echo's in the code).

Any help appreciated! Thanks




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users