PHP cURL Login to Myspace

Discussion in 'Programming' started by ILiketohelp, Apr 18, 2009.

  1. #1
    Does anybody have a working script that logs into myspace using cURL, so that you can use the server to check bulletin proofs instead of manually checking them.
     
    ILiketohelp, Apr 18, 2009 IP
  2. ILiketohelp

    ILiketohelp Guest

    Messages:
    756
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    50 views and nobody can say anything?
     
    ILiketohelp, Apr 18, 2009 IP
  3. tguillea

    tguillea Active Member

    Messages:
    229
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Yeah I have a post that should help you... http://forums.digitalpoint.com/showthread.php?t=1313115

    Try this code

    
    $ch = curl_init();
    // SET URL FOR THE POST FORM LOGIN
    curl_setopt($ch, CURLOPT_URL, "http://domain.com/login.html");
    // ENABLE HTTP POST
    curl_setopt ($ch, CURLOPT_POST, 1);
    // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
    curl_setopt ($ch, CURLOPT_POSTFIELDS, "username_box=username&password_box=password");
    // IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
    curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookies/cookie".rand(11111111,99999999).".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);
    curl_setopt($ch, CURLOPT_FILE, $handle);
    // EXECUTE 1st REQUEST (FORM LOGIN)
    $store = curl_exec ($ch);
    // SET FILE TO DOWNLOAD
    curl_setopt($ch, CURLOPT_URL, "http://domain.com/inside/stats/bulletin_proofs.php");
    // EXECUTE 2nd REQUEST (FILE DOWNLOAD)
    $content = curl_exec ($ch);
    
    PHP:
    $content should contain the entire page you wish to download. I'm not sure what bulletin proofs are so hopefully this will work!

    Regards,
    Tom Guilleaume
     
    tguillea, Apr 19, 2009 IP
  4. ILiketohelp

    ILiketohelp Guest

    Messages:
    756
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    myspace uses a ton of parameters and stuff and so far I can't get it to work with the script above..
     
    ILiketohelp, Apr 19, 2009 IP
  5. tguillea

    tguillea Active Member

    Messages:
    229
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #5
    You may need to set more than just login_box=username&password_box=password

    you may also need to include sessions, change the cookie directory (make sure it exists), etc.
     
    tguillea, Apr 19, 2009 IP
  6. ILiketohelp

    ILiketohelp Guest

    Messages:
    756
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ya I did that and it's still not working...
     
    ILiketohelp, Apr 19, 2009 IP