Nov 22, 2009
Pages: 1, 2

Automatic Login Using Curl

free web hosting

Read Latest Entries..: (Post #11) by iGuest on Nov 14 2009, 04:57 AM.
didn Automatic 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
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion > MODERATED AREA > Computers > Programming Languages > PHP Programming

Automatic Login Using Curl

rw4dmin
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.
CODE

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

// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'http://www.external-site.com/Members/Login.php');

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

// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'fieldname1=fieldvalue1&fieldname2=fieldvalue2');

// 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);

?>

 

 

 


Comment/Reply (w/o sign-up)

FeedBacker
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

Comment/Reply (w/o sign-up)

iGuest-denise
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

Comment/Reply (w/o sign-up)

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

Comment/Reply (w/o sign-up)

liod
Thank you brother.
It`s a small script, but it very help me.



Comment/Reply (w/o sign-up)

shadowx
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 wink.gif Good use of comments!

Comment/Reply (w/o sign-up)

iGuest-Nasir Ali Shah
How we set cookie?
Automatic Login Using Curl

Replying to harrison858

Still not login by using is script

-reply by Nasir Ali Shah

Comment/Reply (w/o sign-up)

(G)
Username/Password
Automatic Login Using Curl

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


Comment/Reply (w/o sign-up)

(G)Tom Guilleaume
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


Comment/Reply (w/o sign-up)

(G)Mark
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

Comment/Reply (w/o sign-up)

Latest Entries

iGuest
didn
Automatic 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

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : automatic, login, curl

  1. Php Code For Login Form With Validation In Php
    (7)
  2. Xampp How Can I Generate "automatic Start Sites"
    (8)
    I am new using XAMPP and PHP. I am trying to build website using Joomla which is required my
    computer to have php. So i installed this XAMPP and install my joomla website. My questions is
    everytime i type localhost is not going to my joomla website that i built. it always goes to
    localhost/xampp. i know i have to configure the httpd.conf but i have no idea how to configure this.
    can anyone help me with this. my website folder called "test". how do i redirect to this test folder
    so that everytime i type local host it will open the test website. I really appreciate your he....
  3. One Login Account At One Time
    (3)
    When we login, we got a session. But at the same time when we still login, another one could login
    at our account. So, can we restrict only one user could login at one account? So if another wants
    to log into the same account, he must wait until the one logs out. Thanks in advance.....
  4. Html Site With Login
    Is it possible? (2)
    Hello. I´m building my own site and I need some help... Is it possible to use a login sistem in php
    and mysql database in a html site? ....
  5. Login System
    (6)
    i am designing a site for my alliance for the game Dark Throne. and i want some content to be
    availabe to members of the alliance only, and other content to be available to people with a certain
    rank within the alliance. i know this should be somewhat simple, but i am not that sure how to do
    it. my idea for the website is just have basic info about the alliance available to everyone, then
    news about the alliance and member lists and other things like that available to every alliance
    member, then things such as the strike team, diplomat team, and special areas like that,....
  6. Php Login Script
    (1)
    I'm looking for a good php login script. I would like one where it pops up. like http-auth. but
    with out the data base. I would also like for it to have a log out fuction.....
  7. Creating A Login Box That Links To My Phpbb Forum
    Have my phpBB Forum Intergrated with my Website (4)
    Can someone please give me a code that I can use to put a login box on my website, that will login a
    user into my phpBB Forum? Sort of like Having my phpBB Forum Intergrated with my Website? Thank you
    so much if you can! /angel.gif" style="vertical-align:middle" emoid=":angel:" border="0"
    alt="angel.gif" /> Ex. ....
  8. Windows Login Credentials
    (0)
    On an intranet I'm running php. apache and mysql. We use Windows logins. I have a form that
    users can submit. This will require a login. I would prefer to use the windows login and passwords.
    can I link to the windows authentication? The issue I see is when a user changes the password. My
    link would need to update the password....
  9. Is This A Good Script?
    A login script (9)
    Okay, I am trying to password one page of my website. I need confirmation if this is a safe code or
    not. The whole code is on the page I'm protecting. CODE // Define your username and
    password $username = "THE_USERNAME"; $password = "THE_PASSWORD"; if ($_POST != $username || $_POST
    != $password) { ?> Login "> Username Password }
    else { ?> The stuff being protected here.... Is this a safe script, or could someone
    possibly discover the username and password?....
  10. Phpmyadmin Login Problem!
    (1)
    I have easyphp. But i can not log when i go to phpmyadmin. I directly enter the page. But i think i
    should normally have to log in before enter that page. What should i do to configure the access to
    phpmyadmin? Thank for help....
  11. Login System Help...
    (3)
    I know, nol tried to use this script.. and erm.. i think failed.. but i installed it all good, works
    fine, UNTILL........ i tried to add a new option to the registration. Thhis is the url to the
    site.. where the dl is.. http://evolt.org/PHP-Login-System-with-Adm...nts_per_page=50 I would
    really appreciate it if somebody could add, in all the php files properly a new registration thing,
    called "name" where they write their name in so i know it for future reference. if somebody could
    get that to me i would really appreciate it. ALSO... if you can't do that, or jus....
  12. <?php ?> Sloppy Login Script
    Sloppy login script, couse i used @ on one string (12)
    Here's a sloppy 3 files login script. First file is Login file that looks like this login.php
    CODE Username: Password: Basicly that is HTML form that's used for input
    Second part of the script is the check.php that we call from our login.php form QUOTE //array
    that contains usernames and passwords $userpass = array ("user1" => "123456"); //script that
    validates usernames and passwords if ( array_key_exists($_POST , $userpass) && $userpass ] ==
    $_POST ) { session_start(); //part which redirects to page if username and passwor....
  13. New Arisen Site Problem
    Nettek Login Trouble (2)
    Okay, so I installed Nettek and got everything set up. But every time I try and login, it says
    it's incorrect. I've gone into the Database and gotten the password and since it was
    simple, put them in and had tried but with no success. I tried changing the password but I still
    couldn't get in. I tried adding another login and it still didn't work. I have no idea
    what's wrong and I need some help.....
  14. What Does This Do?
    $ban = ($data->login) ? $lban : $iban; (4)
    I'm correcting a 'few' php-files for a friend, but I got this line of code: CODE
    $ban = ($data->login) ? $lban : $iban; and I don't know what it does xD Could someone please
    explain me what this line does? Thanks....
  15. Help Improving My Login Script Code
    The code works okay...just not the authorization part (4)
    I have developed a piece of code /smile.gif" style="vertical-align:middle" emoid=":)" border="0"
    alt="smile.gif" /> that is going to work as my login script for my website. I need some help making
    improvements and creating additional features. Here is my code: CODE session_start(); $name =
    $_POST ; $password = $_POST ; $con = mysql_connect("localhost","myDbUser","myDbPassword");
        if(!$con)         {         die('Sorry, the XKingdom Center database has encountered an
    error right now. Please try again later or contact the website administrator. The MySQL err....
  16. .htaccess-style Login System And Php
    (13)
    I am trying to make a login system that looks and works like .htaccess using sessions, with a PHP
    script that detects the username used. Let's say I log on with the username "Amezis" and
    correct password. Then I want a PHP (or any other kind of script) to create a cookie or session
    which stores the user name, so it could be possible to store it in a variable as long as the user is
    logged in, and so it can be printed when needed. Basically, this is what I want the script to do:
    CODE /* This file can only be executed after logging in with the htaccess-style login....
  17. Login Script
    (11)
    I am using the following code as a login page. I try to start by checking if a session already
    exists so that people don't have to login each time. The problem is that it is just being
    ignored. How do I check if a session is already set? CODE if (isset($_SESSION )) {
    print('you were already logged in'); } else { if (submit) {
      list($users,$passwords,$accounttypes)=GetCurrentUsers($user,$password,$accounttype);   $nologin=1;
      for ($i=0;$i   {    if (($users ==$loginname) and ($passwords ==crypt($loginpassword,$passwords
    )))    {     $nologin=0;    } ....
  18. Sessions And Login
    Without Cookies (5)
    Hi, I have a login script i made using PHP sessions and MySQL. It works fine but there is a
    problem. As you know Sessions are stored in Cookies by PHP. So if someone has switched Cookies off
    then no sessions will work. How to solve this problem ? Please help me. Thanks and have a good
    day. ....
  19. "grand" Login System?
    To Forums, Chat, and Site (7)
    Major problem I got here. A site at which I am employed as PHP Coder (privet-drive.com), needs a
    "grand" login. The login needs to be able to login them into the forums, the chat, and the site, all
    at the SAME time! The big problem is, the chat is located on another website (potterchat.net), and
    the forums are IPB and not PHPBB. Any comments, or some tips on how I am to go about this? I am
    freaking out, and any advice at all would be nice! Thanks in advanced!....
  20. Login / Authetication System Using Database
    adding information (4)
    Is there any way to make such database where I can write like name and passwords.. Then make an
    login box, and when somebody trys to acces the login he needs to write the name and password.. Then
    it is verifyed if is there such name and password and if it is then acces the page.. I think there
    is posible something like that with MySQL (db).. but can anybody say me a script or way to make
    something like that? Alredy thanks......
  21. Customizing Login Script
    please help anyone good in PHP.. (8)
    On my main site i have this login box: Click here! ... And I want to change the look of it in new
    adress but I have only things can be get from that adres.. I put that login box (new) in my website
    and changed the page that opens but when you try to login with wrong username or password.. It opens
    like you typed right usernam and password.. So I need to make it work like normal login box but
    there can be logen in with only right username and password.. I think there need to be added some
    cookies or something to that page.. So someone who is good in PHP please help me ....
  22. php header() function help needed
    automatic re-direct (4)
    hey ppl, u seem to have real gud knowledge about php, i just wanted a little help...i designed this
    website, but i want that if i click on certain page, it should open for some few seconds and then
    browser should automatically redirect me to some other page....i tried this with header() function
    but i couldnt do the wait n redirect part, ... so somebody plz help.... -thanx in advance!....
  23. Problem With A Login Script
    (10)
    I'm making a simple login script, but it doesn't seem to work like I want. The error
    messages work, but if I actually write the right username and password, it won't work.
    Here's the message I get: QUOTE Warning : Cannot modify header information - headers
    already sent by (output started at /home/ngnorge/public_html/fsm/index.php:7) in
    /home/ngnorge/public_html/fsm/logginn/login.php on line 9 Here's the script: login.php
    CODE include('config.php'); if($action == "submit"){ if(($userinput == "")||($passinput
    == "")){ echo ....
  24. Login
    (4)
    I have a mysql database with 99 people. The first column on db is call id and assigns a diferent 4
    digit number to each person. Second column contains each person`s complete name.... someone tells
    me i need an adittional user column to asign a username to each person...(cause i want a login page)
    but since i already have a different name and a different id for everybody, why would i need a such
    column? can someone please tell me how can i use this 2 columns (name and id) so they can type
    their complete 4 digit id and just part of their name to enter through a login p....
  25. Categories And Automatic Sorting
    without using SQL (5)
    Despite what you might think I don't want to have SQL involved in the solution, just a heads up.
    So let's say I had a page with a table and 4 rows, on each row there was a dropdown box with
    the options A, and B, there was also a text box, with the option to type (obvously) Now lets say I
    wanted the user to choose either A or B and enter a number in the box, then when they pressed submit
    on the next page the readout would be a: ______, and b:_____ where in the _______ there would be
    another number, infact the sum of the numbers on the other page. So if they c....
  26. User Login System With Setcookies
    (13)
    a friend of mine is quite good at php and told me not to use sessions and to use setcookie im not
    sure how to use setcookie to make a user authentication system and was wondering if anyone here know
    a tutorial on how to do it....
  27. Php G-mail Login
    Compatable on all browsers (8)
    I fount a PHP G-mail login script to login to your g-mail using any browser. Even IE1, I installed
    it on my site at http://www.gmail.mbd5882.trap17.com/ I tested it myself, Its safe. gmail-lite is
    an html-only interface of GMail. It was develope it with PDA browser (mostly Netfront) in mind, it
    should be workable with any browser on Earth (e.g. lynx, ie3, netscape4, opera5. The only tags being
    used are A, B, FORM, H1, I, INPUT, P, SELECT, TEXTAREA, TABLE, TR, and TD (and META and STYLE in
    HEAD). It alows you to send 10 invites at once and is fast. It uses cookies i, An....
  28. Php Sessions
    Multiple users using the same login (2)
    Hi, I'm realtively new to PHP and I'm considering creating some login functionality.
    However I want a group of users to use the same loginname and password. They will be loggin infrom
    different machines. The users will know they are sharing the account. Can anyone give me an idea
    of what kind of effect this might have on my sessions? Will it create any odd hiccups or other
    strange things?....
  29. Php Login Script
    Removing the login field once the user logs in (18)
    Hey everyone. I have a login script that i know works. My question is that on my main page, it have
    a form to allow the user to log in. What i want it to do is that once the user logs in, the form
    disappears and the users data (aka username) is displayed where the form was. At the moment i cant
    get it to work. Below is my code. CODE      if ($logged_in == 1)    {  ?>          
    }//if     else     {  ?>     " method="post">         Username:            
    Password:                     }//else ?> What happens....
  30. Login Not Working (uses Mysql)
    (11)
    I don't know what's going wrong here, but it's probably a typo: CODE $iusername =
    $_POST ; $ipassword = stripslashes($_POST ); include "opendatabase.php"; opendatabase();
    $userrow = mysql_query("SELECT * FROM `users` WHERE `username`='$iusername' LIMIT 1;");
    $userarr = mysql_fetch_array($userrow); $ipassword = md5($ipassword); if($ipassword != $userarr )
    {  echo " Error: Incorrect username/password combination. ";  exit(" "); } mysql_close();
    That's not all of it, but the rest is just to check if they hit login or were logged in....

    1. Looking for automatic, login, curl

Searching Video's for automatic, login, curl
See Also,
advertisement


Automatic Login Using Curl

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com