Automatic login using curl

Discussion in 'PHP' started by helphelp, Feb 15, 2010.

  1. #1
    I am trying to auto login to linked In using curls script.
    Below is my script
    $userAgent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
    curl_setopt($ch, CURLOPT_URL, 'https://www.linkedin.com/secure/login');
    curl_setopt ($ch, CURLOPT_POST, 1);

    curl_setopt ($ch, CURLOPT_POSTFIELDS, 'session_key=loginemail&session_password=password');

    curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
    curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

    // EXECUTE 1st REQUEST (FORM LOGIN)
    $store = curl_exec ($ch);

    this is giving the following error;

    Make sure you have cookies and Javascript enabled in your browser before signing in.


    Any one know what should be the issue?
     
    helphelp, Feb 15, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #2
    danx10, Feb 15, 2010 IP
  3. davebrwn

    davebrwn Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think you can't use curl to login on linkedin as they are secure.

    Thanks
     
    davebrwn, Feb 16, 2010 IP
  4. uworks

    uworks Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Based on my experience in cURL I would suggest you to use Tamper Data and Web Developer addons in Firefox. I would have given you the script but i don't have a account on Linkedin so i cant make the script. I checked it with Tamper Data. You might not be able to login because in your POSTFIELD you haven't added the value of csrfToken. Open the source and search for "<input type="hidden" name="csrfToken" value= ". The value of this also needs to be passed. Use a preg_match and get it done.
    Thanks,
    uworks
     
    uworks, Feb 18, 2010 IP
  5. indovpn

    indovpn Guest

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I agree with danx10
     
    indovpn, Feb 18, 2010 IP