• 07
  • Feb


I was trying to automate logging into MySpace with PHP and cURL, and I had some problems. For some reason, it kept kicking me back to the homepage rather than the logged in page… and finally I figured out why. I’ll post the code up here for anyone else who has a similar issue.

Basically, to automate the MySpace login system, you need these steps:

  • First setup your cURL session with a cookie file and a cookie jar. They’re obviously required. You will also NEED to specify a user agent… that’s what got me. MySpace checks your user-agent, and if it doesn’t match a known one, they abort your login process.
    // setup and configure
    $ch = curl_init();
    $randnum = rand(1,9999999);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookiejar-$randnum");
    curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookiejar-$randnum");
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 0);
  • Visit the myspace.com homepage, and scrape the security token, which is made into the URL where the login form submits (the form action):
    // get homepage for login page token
    curl_setopt($ch, CURLOPT_URL,"http://www.myspace.com");
    $page = curl_exec($ch);
    //
    // find it....
    //
    preg_match("/MyToken=([^"]+)"/",$page,$token);
    $token = $token[1];
  • Next actually post your information and submit the login form. You must forge the referer as myspace.com, and you must specify the content type in the HTTP header as “application/x-www-form-urlencoded”. Notice my last appending line on $poststring is a bunch of semi-encoded values… that is the rest of the form MySpace sends with your login. It’s a required line for their internals, don’t omit it.
    // do login
    curl_setopt($ch, CURLOPT_URL,"http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken={$token}");
    curl_setopt($ch, CURLOPT_REFERER, "http://www.myspace.com");
    curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded"));
    curl_setopt($ch, CURLOPT_POST, 1);
    $postfields = "email=" . urlencode($YOUR_EMAIL);
    $postfields .= "&password=" . urlencode($YOUR_PASSWORD);
    $postfields .= '&ctl00%24Main%24SplashDisplay%24login%24loginbutton.x=38&ctl00%24Main%24SplashDisplay%24login%24loginbutton.y=15';
    curl_setopt($ch, CURLOPT_POSTFIELDS,$postfields);
    $page = curl_exec($ch);
  • The next page you’ll hit is a 302 redirect to the internal login page. This might be handled automatically, but I’m going to scrape the redirect url and pass it manually, as a precaution.
    // find redirect url
    preg_match("/replace\("([^"]+)"/",$page,$redirpage);
    $redirpage = $redirpage[1];
    //
    // do the redirect
    //
    curl_setopt($ch, CURLOPT_REFERER,"http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken={$token}");
    curl_setopt($ch, CURLOPT_URL,$redirpage);
    curl_setopt($ch, CURLOPT_POST, 0);
    $page = curl_exec($ch);
  • Now you should be at the logged in page. I run a quick check that it didn’t bounce us back to the login page for an invalid username or password before proceeding:
    // check login error
    if(strpos($page,"You Must Be Logged-In to do That!") !== false){
    // login error
    return 2;
    }

Congratulations, you’re now logged into MySpace. I fought with this for a while because I didn’t know they check the user-agent (most sites don’t care), and I was getting really strange results when trying to log in.

From this point, you can do whatever you want, such as send messages, post bulletins, modify your profile, etc. For requesting the modify-your-profile page, here’s the code:
// find edit profile link (with token attached)
preg_match("/ id="ctl00_Main_ctl00_Welcome1_EditMyProfileHyperLink" href="([^"]+)"/",$page,$redirpage);
$redirpage = $redirpage[1];
//
// go there (edit profile)
//
curl_setopt($ch, CURLOPT_URL, $redirpage);
$page = curl_exec($ch);

Simple!

And before you finish, don’t forget to clean up by closing curl and deleting the cookie file you made:
// clean up
curl_close($ch);
@unlink("/tmp/cookiejar-$randnum");

I’d recommend getting the Live HTTP Headers Firefox Add-on if you don’t have it already, as it makes debugging these processes much easier.

Here’s the entire source code uncut:

$ch = curl_init();
//
// setup and configure
//
$randnum = rand(1,9999999);
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookiejar-$randnum");
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookiejar-$randnum");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 0);
//
// get homepage for login page token
//
curl_setopt($ch, CURLOPT_URL,"http://www.myspace.com");
$page = curl_exec($ch);
//
// find it....
//
preg_match("/MyToken=([^"]+)"/",$page,$token);
$token = $token[1];
//
// do login
//
curl_setopt($ch, CURLOPT_URL,"http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken={$token}");
curl_setopt($ch, CURLOPT_REFERER, "http://www.myspace.com");
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded"));
curl_setopt($ch, CURLOPT_POST, 1);
$postfields = "email=" . urlencode($YOUR_EMAIL);
$postfields .= "&password=" . urlencode($YOUR_PASSWORD);
$postfields .= '&ctl00%24Main%24SplashDisplay%24login%24loginbutton.x=38&ctl00%24Main%24SplashDisplay%24login%24loginbutton.y=15';
curl_setopt($ch, CURLOPT_POSTFIELDS,$postfields);
$page = curl_exec($ch);
//
// find redirect url
//
preg_match("/replace\("([^"]+)"/",$page,$redirpage);
$redirpage = $redirpage[1];
// do the redirect
curl_setopt($ch, CURLOPT_REFERER,"http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken={$token}");
curl_setopt($ch, CURLOPT_URL,$redirpage);
curl_setopt($ch, CURLOPT_POST, 0);
$page = curl_exec($ch);
//
// check login error
//
if(strpos($page,"You Must Be Logged-In to do That!") !== false){
// login error
return 2;
}
//
// LOGGED IN, now let's play
//
// find edit profile link (with token attached)
//
preg_match("/ id="ctl00_Main_ctl00_Welcome1_EditMyProfileHyperLink" href="([^"]+)"/",$page,$redirpage);
$redirpage = $redirpage[1];
//
// go there (edit profile)
//
curl_setopt($ch, CURLOPT_URL, $redirpage);
$page = curl_exec($ch);
//
echo $page; // do whatever you need to do
//
// clean up
//
curl_close($ch);
@unlink("/tmp/cookiejar-$randnum");

» Both comments and pings are currently closed.

92 Comments

  1. Myspace Codes » Blog Archive » MySpace Login with PHP and cURL Says:

    [...] post by hmaugans and software by Elliott [...]

  2. bart Says:

    It looks nice. I created an account on myspace.com to test your script. When I copied entire source code and replace strings with my email and password only, this script didn’t work – I saw white blank page.
    I add “echo” line like below to test if anything is available.

    $page = curl_exec($ch);

    echo $page;
    //
    // find redirect url
    //

    And I saw myspace.com site I was logged in.

    1. Could you tell us what version of curl and openssl does it work for ?
    2. And what this line means ? Where is “replace string” ?
    preg_match(“/replace\(“([^"]+)”/”,$page,$redirpage);

  3. Harry Says:

    Bart,

    This was done with php5-curl-5.2.0_1 and php5-openssl-5.2.0.

    If you can echo the page and it shows you logged in, then the script worked as expected.

    What are you trying to do? With a little more information on your situation, I’ll try to be more helpful.

    Regards,
    - Harry

  4. bart Says:

    I received “adcount4″ as
    preg_match(“/replace\(“([^"]+)”/”,$page,$redirpage);
    $redirpage = $redirpage[1];

    echo $redirpage;

  5. bart Says:

    I looked at your source code because I search a solution to solve problem like this http://curl.haxx.se/mail/archive-2003-05/0013.html

    When I am at my url I see the headers with Live HTTP Headers, they are :

    https://domena.pl/kat/podkat/skrypt.php

    POST /kat/podkat/skrypt.php HTTP/1.1
    Host: domena.pl
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.1)
    Gecko/20061204 Firefox/2.0.0.1
    Accept:
    text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    Accept-Language: pl,en-us;q=0.7,en;q=0.3
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Referer: https://domena.pl/kat/podkat/skrypt.php
    Cookie: PHPSESSID=511dca8bfb572b2b24100b09280b17fe
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 133
    zmienna1=cos1&zmienna2=cos2

    HTTP/1.x 302 Found
    Date: Sun, 18 Feb 2007 23:34:05 GMT
    Server: Apache
    X-Powered-By: PHP/4.4.0-pl1-gentoo
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
    pre-check=0
    Pragma: no-cache
    Location: /kat/podkat/skrypt.php
    Content-Length: 0
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Content-Type: text/html; charset=ISO-8859-2

    ———————————————————-
    https://domena.pl/kat/podkat/skrypt.php

    GET /kat/podkat/skrypt.php HTTP/1.1
    Host: domena.pl
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.1)
    Gecko/20061204 Firefox/2.0.0.1
    Accept:
    text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    Accept-Language: pl,en-us;q=0.7,en;q=0.3
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Referer: https://domena.pl/kat/podkat/skrypt.php
    Cookie: PHPSESSID=511dca8bfb572b2b24100b09280b17fe

    HTTP/1.x 200 OK
    Date: Sun, 18 Feb 2007 23:34:06 GMT
    Server: Apache
    X-Powered-By: PHP/4.4.0-pl1-gentoo
    Expires: 2007-02-19 00:34:06
    Cache-Control: no-store, no-cache, must-revalidate, pre-check=0,
    post-check=0, max-age=0
    Pragma: no-cache
    P3P: CP=”ALL DSP COR NID CURa OUR STP PUR”
    Last-Modified: 2007-02-19 00:34:06
    Content-Length: 3157
    Keep-Alive: timeout=15, max=99
    Connection: Keep-Alive
    Content-Type: text/html; charset=ISO-8859-2
    ———————————————————-

  6. Harry Says:

    Hum, posting to the login page itself seems to be having issues.

    MySpace must have changed something. I’m heading out right now, but later on I’ll try looking into it.

  7. bart Says:

    I managed to implement desired script :) Thanks to you, for publishing your source code.

  8. Harry Says:

    Sure thing bart, I’m glad you got everything worked out.

  9. Russell Says:

    Is this script is still working or they have changed something? Does not work in my case. Just get a blank screen.

  10. Amir Meshkin Says:

    Hi Guys,
    This is the best script for logging into myspace that I have found, but its broken now. Myspace definitely changed something. When I echo the contents of $page, i get the YOU MUST BE LOGGED IN TO DO THAT screen.

    All I want to do, is log into myspace, and post some html into the music section. I can’t seem to figure this out. :(

  11. Greg Sidberry Says:

    I’m using php 4 with curl. and i’m echo $page after every call. it’s going to the page and logging into myspace with no issues. the error seems to be what’s done after login.

  12. Greg Sidberry Says:

    ok i got it working heres the issues :

    1. when checking for redirect – at that point you are logged.

    2. token changes when you login. so you need to grab the new token

    3. the redirect url isn’t correct : “http://home.myspace.com/index.cfm?fuseaction=user&MyToken=$token”

    4. referer should be : “http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken=$token” using the new token

    5. heres the only changes i made that matter.
    $old_token=$token;
    $token=NULL;
    // find redirect url
    preg_match(“/fuseaction=user&Mytoken=(.*)”/”,$page,$token);
    print_r($token);

    $token = $token[1];
    $redirpage=”http://home.myspace.com/index.cfm?fuseaction=user&MyToken=$token”;
    //
    // do the redirect
    //
    curl_setopt($ch, CURLOPT_REFERER,”http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken=$token”);

    —end fix

    Also again thank you so much for this tutorial, this is awesome. You’ve seriously saved me alot of time.

    hope this helps, sid

  13. Greg Sidberry Says:

    http://elsid.net/2007/myspace.php – putting it to use

  14. Elvis Says:

    Okay, thanks to Gred and Harry I got it working, at least to login. MySpace is doing something very strange though when it comes to friend requests.

    I wrote some additional code that follows the login, that basically:

    1. Goes to a friend page using a friend ID and curl
    2. Picks up the token and goes to the ‘Cofirm Add Friend Page’
    3. On the Confirm Add Friend Page there is a button to press. I used cURL to submit the form using this button and it’s associated token, along with using the correct referrer token that was picked up on the basic friend page.

    Now the funny thing is, it completes the task correctly, in that the final echo of the curl echos the page that says :

    “An email has been sent to the user for your request to add this user.
    Return to View Profile”

    So it looks like it did it right? Wrong. Even though it gets through this whole procedure when you go to look at your pending friend invites, the person you invited is not listed as pending.

    So even though MySpace shows you what you want to see, it doesn’t actually DO the friend invite request. I noticed on that final button press to add the friend if you look at the page code, the button has the following onclick code on it “window.history.back()”. So what does that do exactly? Like it submits the form and then goes backwards to do something else or vice versa?

    Is this some secret trick or extra step without which friends can’t be added, even though it will tell you it sent the email??

    Anyone got any ideas on this I’m all ears…

  15. kelly black Says:

    where do i put the code ? so i can get into myspace

  16. kellyblack Says:

    hey harry,im have some major problems with myspace, so i wanted to know if you can help me.

    As of today I am totally over myspace!!
    I AM VERY IRITATED!!!!! here’s my problem,
    I really *crosses fingers* hope you can give me some real solutions to this problem.anway heres my mini drama story:

    Yesterday I changed my old email address for my myspace.
    I received the conformation email,ect ect…
    Futhermore, I tried to login to myspace and it didn’t let me. then after the third attempt it said the following:
    “Too many failed login attempts for this email. Please enter verification code.” I did the procedures but I am confused as to what the next step is. so no help there.

    S0 then I tried contacting “myspace customer service”
    OMG!! WHAT A JOKE!! I emailed them with the same complaint
    8 times!!! and I still havent recived any replies, its been a week !!!!

    I also tried to find my email address but it said:”
    Sorry we weren’t able to find ______________.com ” on MySpace.com,
    which made me even more upset ,because I had just finished changing my email address.

    All of my information is correct I dont understand why it keeps doing this! can someone help me fix this?!

    oh I was also wondering if there was anyway to resend the email conformation link to my old email, so I can possibly start over.

    PLEASE SOMEONE/ANYONE HELP A GIRL OUT
    thankyou very much

  17. ALICIA Says:

    Hey yeah. I didn’t use this thing, I’m just in school right now and don’t want to do what I am suppose to do so I’m commenting this thingy. Well, it looks pretty cool. I have no idea what you guys are talking about but okay. I’m going to pretend I do and agree. so yea. Umm I don’t know.

  18. Tony Pugliese Says:

    Harry,
    Excellent piece of work. Have you done any other curl scripts like to access Yahoo or ebay or Wellsfargo or Bank of America or anything else. I think your work has real potential.
    Tony

  19. Angel Moreno Says:

    where is the latest code to this? I am trying to create an app to copy my messages from myspace and email them to me. i don’t know curl much i am uased to the snoopy php class. but it does not do he job for myspace.

  20. kendric Says:

    hi,

    sorry but i would just like to ask if theres anyone who can help, i am an ojt in a company right now and i have been assigned to do a scraping program that scrapes all the friends of a myspace user. i have already written a scraping program in PERL using MECHANIZE::SHELL and its working fine.

    the problem is i havent been able to scrape anything past page 1 of the friends list. the link to the other pages are all in javascript and each page of the myspace friends list has the same URL so the only way is to click the page link which MECHANIZE::SHELL is not able to.

    what i would like to ask is curl able to do this particular task?

    thank you to anyone who can help and sorry for the trouble.

  21. Greg Sidberry Says:

    first – if your having issues grabbing the token its because myspace likes to play with cases add an i to the end of your regex and you’ll be good.

    second harry sorry if i’m jacking your topic please delete this post if i am doing so.

    that said : Hi guys, once again thanx so much to harry for giving us the ground work

    I’ve updated ver. 1 of my class (sorry didn’t post it here). it’s now at 2.2 and will be released shortly. i’m just waiting on the name of my co author so i can update the credits

    right now it has myspace login, bloging, and image functions, and a lot more.

    I rewrote the whole thing to be oop

    temp project page : http://elsid.net/2007/myspace/

    I’m trying to find some people who’d like to help on development of this.

    once again thanx to harry. your walk through was the start of all this. you opened my eyes :)

    right now i’m working on next version, features slated are profile editing, blog edit, comments and mail checking, possible spidering, and maybe open access to hi5 also.

    email me poetics5 [at] yahoo if you’d like to help with dev.
    please contact about dev if your serious, i’m hoping to have this to ver 3 within 30 days so any help would be great.

    any feature requests should go to same addy.

  22. SnakeEater251 Says:

    Thanks a lot for your tutorial. It helped a lot with what I was trying to do, I’ll give you credit once the page I was working on is online. Thanks a bunch and happy coding!

  23. Paolo Says:

    thanks a lot for this tutorial it’s perfect !!!
    I took inspiration for monitoring my live betting account , using Curl Lib

    ciao

    Paolo

  24. Jonathan Says:

    Hi Harry,

    I have also implemented a php solution to login and post on myspace which works fine.

    However, I’ve been trying to implement a myspace commnet on friend’s profile page functionality which refuses to work.
    The scenario for adding a comment is:
    1. Login to myspace (works)
    2. Fetch friend’s profile page and retrieve add comment link + token etc (works)
    3. Fetch the add comment page and post to the form’s url with all data submitted by browser (works)
    4. Confirm submit page – fetch the form’s url and emulate all data submitted by browser FAILS! – I get a and a “Sorry! an unexpected error has occurred” message

    I have gone over all the request headers, including referer, accept, etc and to no avail. It posts all the data same as browser but doesn’t work.

    I can’t figure out how can myspace servers tell the difference but they do.

    If possible I would like to consult with you or perhaps outsource this project to you.

    Thanks
    Jonathan

  25. *GUTTA-B00* Says:

    HEEEY WAT IT DO IM SITTIN MY DUMB BLACK AZZ IN THIZ CHAIR TRYNA GET ON MYSPACE IN SCHOOL!!! IF YOU KNOW HOW PLEASE HALLA AT CHA GURL N TELL ME WHO THA FUK TO GET ON!! LOVE ALWAYZ *GUTTA-GUTTA-BOO*

  26. jam Says:

    Please someone tell me how to uplaod video on myspace.com…..with php and curl….i have been trying for it….i m able to get inside i.e . to do successfull login in my account but after that if i try to access video uplaod page with curl …it gives me 302 HTTP error …..please help….

  27. Greg Sidberry Says:

    ok well i’ve updated the class. http://elsid.net/2007/04/27/myspace-access-class-ver-24/

    as far as what it does here ya go:

    blog posting
    commenting
    friendslist navigation
    navigate myspace
    provides a base framework to allow your own custom myspace functions
    music player extraction
    ability to extraction info with friend id / user url
    error support
    tokens are extracted automatically
    maintains navigation and page history

    probably more, but i’m more concerned with the features being worked on now – which are:

    bulletins
    profile editing
    blog editing
    friend requesting

    hope that answers your questions – sid

  28. Claude Gagnon Says:

    Did somebody if something like this exist for YOUTUBE, i would be nice to have this to download flagged video

  29. KIMBERLY Says:

    HEY MY PROLBLEM IS THAT I CAN LOG IN MY………………MYSPACE…I DO REMEMEMBER MY E-MAIL AND MY PASSWORD….BUT IT DOESN’T LET ME…..
    WAT SHOULD I DO HELP ME!!!! =[

  30. Yo Says:

    Hi,

    This all seems very helpful. I have but one problem – im not a php guy, but a java guy. Any information as to how to this java-style would be much appreciated!
    BTW – is there no way around the cookie deal? and assuming there isnt, am i understanding correctly that this is a per-session cookie?

  31. Sike Says:

    I put all three php files on my server and tried typing in my user name pasword. The errors I got where…

    Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/ahurfnay/public_html/myspace.class.ver.2.php on line 142

    Notice: Undefined offset: 1 in /home/ahurfnay/public_html/myspace.class.ver.2.php on line 273
    0 : 99999999

    Fatal error: Call to undefined function: makeerror() in /home/ahurfnay/public_html/myspace.class.ver.2.php on line 230

    Do I need to change something in the codes to make these erros go away? I have the code up at http://www.johnklippenstein.com/index.php

  32. Eerhsa Says:

    Hi,

    I’m facing issues, while posting bulletin to myspace (using curl).
    Anyone got any ideas on this ???

    Thanks.

  33. olivier Says:

    Indeed, MySpace slighly changed the html code the friends page. This change makes it impossible to retrieve user info and therefore to post comments.

    Here’s the correction.

    In the populateFriendList method, the regex matching links to friends should now be wrtitten as follows:

    /viewprofile&friendid=(.*)”>(.*)\s+(\s+)/i

    Here, the onerror has been added, along with some line breaks. The fix must be applied both on the test (if(preg_match(“…”)) and the preg_match_all that allows to get the needed info.

  34. cindy Says:

    HELP me is about my myspace i have my password but it dont let me log in

  35. seth Says:

    cant login to myspace erro
    can you fix it for me

  36. tay Says:

    MYSPACE PAGE SAYS TOO MANY FAILED ATTEMPTS, ALTHOUGH I HAVE ENTERED IN THE CORRECT LOGIN INFO. I EVEN HAD THE PASSWORD EMAILED TO ME JUST TO BE CERTAIN OF WHAT IT IS. NOW WHAT? I NEED HELPPP.

  37. WordPress to MySpace Auto Crossposting Says:

    [...] Greg Sidberry over at elsid.net and his MySpace Access Class and by extension Harry Maugan for his MySpace Login with PHP and cURL and Brad Turcotte (brad [at] bradsucks.net) for some initial development. I may clean up my version [...]

  38. Travis McCrea Says:

    I don’t want to seem lazy but could you atleast point me in the right direction for adding bullitens to myspace?

  39. charles charrier Says:

    MY myspace isnt working it keeps saying to many faild login attempts every thing i put for imformation is correct i made sure. I still cant get in i dont want too have too make another myspace all over again. I also dont want to hve TO MAKE HUNDREDS OF friends again can u fix dis problem before somthin else gos wrong please. and now u website keepps saying i already said dis now im sick and tired of dis help me im irritatid fix dis problem i am maaad

  40. EL Says:

    can you tell me how to bypass the “Age Verification” page at PornoTube.com ? i still cant make it.. :(

    thanks.. :D

  41. EL Says:

    forget it.. i just figured it myself.. :P

  42. Michael D Price Says:

    Hmmm ….

    I cannot get it to work correctly for me.

    I get through the redirect, it displays my home page, then redirects me to The Myspace domain with the login error message!

    Frustrating

  43. Alex Says:

    I can’t get this script to work for the life of me… it just shows a blank page..

    Im lost, any help?

  44. Vidhya Says:

    Hi all,
    I tried entering into a database link with the username, pwd, agentid and version of the link using cURL in php. my problem is i found the error invalid version. i couldn,t enter into that site using cURL in php. but the version i gave is correct only. Help me.

  45. robert Says:

    hi im having trouble in myspace because i keep putting the right email and password and it says wait 15 minutes your myspace has been locked. it has been a week now and it keeps doing it. i read everything above but i dont know how to use that or where to put those codes. PLEASE HELP!! I DONT WANT TO MAKE A NEW MYSPACE.

  46. erika Says:

    well just wanted to say dat i.d.k how dis works….and does dis get chu into myspace even dough is blocked?????? i dont get it!!!!!!!!!!!

  47. bilal Says:

    hi i m having trouble in login in myspace account can any on send me what i have to change in my code. help me where i m doing wrong.
    my code is:

  48. bilal Says:

    hi i m having trouble in login in myspace account can any on send me what i have to change in my code. help me where i m doing wrong.
    my code is:

  49. ahmed Says:

    what’s wrong in this code:

  50. Pinky Says:

    Hi All,

    I have to grab whole adrress book from my mysapce account, I have created code from all above description & comments like this,

    class myspace
    {
    var $dir_path = “”;
    var $error_msg = “”;

    function grabMyspace()
    {
    require_once(‘./config.php’);
    $this->dir_path = $DIR_PATH;
    $this->error_msg = $ERROR_LOGIN;
    }

    function getAddressbook($YOUR_EMAIL,$YOUR_PASSWORD)
    {
    $ch = curl_init();

    // setup and configure
    $randnum = rand(1,9999999);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $this->dir_path.”/tmp/cookiejar-$randnum”);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $this->dir_path.”/tmp/cookiejar-$randnum”);
    curl_setopt($ch, CURLOPT_USERAGENT, “Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1″);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 0);

    // get homepage for login page token
    curl_setopt($ch, CURLOPT_URL,”http://www.myspace.com”);
    $page = curl_exec($ch);
    //echo “1 – “.$page;
    // find it….
    preg_match(“/MyToken=([^"]+)”/”,$page,$token);
    $token = $token[1];

    // do login
    //echo “http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken={$token}”;
    //http://login.myspace.com/index.cfm?fuseaction=ad&MyToken=29d7d57e-b2c9-4d44-825c-7139f2fbcd49
    curl_setopt($ch, CURLOPT_URL,”http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken={$token}”);
    curl_setopt($ch, CURLOPT_REFERER, “http://www.myspace.com”);
    curl_setopt($ch, CURLOPT_HTTPHEADER, Array(“Content-Type: application/x-www-form-urlencoded”));
    curl_setopt($ch, CURLOPT_POST, 1);
    $postfields = “email=” . urlencode($YOUR_EMAIL);
    $postfields .= “&password=” . urlencode($YOUR_PASSWORD);
    $postfields .= ‘&ctl00%24Main%24SplashDisplay%24login%24loginbutton.x=38&ctl00%24Main%24SplashDisplay%24login%24loginbutton.y=15′;
    curl_setopt($ch, CURLOPT_POSTFIELDS,$postfields);

    $page = curl_exec($ch);
    //echo “2 – “.$page;

    $old_token=$token;
    $token=NULL;

    // find redirect url
    preg_match(“/fuseaction=user&Mytoken=(.*)”/”,$page,$token);

    $token = $token[1];
    $redirpage=”http://home.myspace.com/index.cfm?fuseaction=user&MyToken=$token”;

    // do the redirect
    curl_setopt($ch, CURLOPT_REFERER,”http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken=$token”);
    curl_setopt($ch, CURLOPT_URL,$redirpage);
    curl_setopt($ch, CURLOPT_POST, 0);
    $page = curl_exec($ch);
    //echo “3 – “.$page;

    // check login error
    if(strpos($page,”You Must Be Logged-In to do That!”) !== false){
    echo $this->error_msg;
    exit;
    }
    else
    {
    //echo “Login Successfully………..”;
    }

    // LOGGED IN, now let’s play
    preg_match(“/ id=”ctl00_Main_ctl00_Welcome1_AddressBookHyperLink” href=”([^"]+)”/”,$page,$redirpage);
    $redirpage = $redirpage[1];

    // go there (Addredd Book)
    curl_setopt($ch, CURLOPT_URL, $redirpage);

    $page = curl_exec($ch);

    //pars page to get user name and email from addressbook
    $regexp = “(.*?)”;
    preg_match_all(“/$regexp/s”, $page, $username);

    $regexp = “(.*?)”;
    preg_match_all(“/$regexp/s”, $page, $emails);

    $regexp = “href=”([^"]*)”>]*>SignOut”;
    preg_match_all(“/$regexp/s”, $page, $logout);

    curl_setopt($ch, CURLOPT_URL, $logout[1][0]);
    $page = curl_exec($ch);

    curl_close($ch);
    @unlink(“/tmp/cookiejar-$randnum”);

    $result['name'] =$username[1];
    $result['email'] = $emails[1];
    //$result=array_merge($username[1],$emails[1]);
    return $result;
    }
    }

    My Login URL is as below.

    http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken=5d55ce7b-7d51-42a0-b02c-5dfd39294f66‘;return true;

    And It gives error message on when run on browser like ,

    “This account has been locked for 15 minutes due to excessive failed login attempts. Please try again later.”

    I can’t do login in myspace account.

    Please help me out in this issue :(

  51. mirae Says:

    i have problems to open to the page that i want to login to myspace..i don’t know why this problems can happend..please help me to login to myspace…

  52. tarak Says:

    Hii,

    I am looking for myspace login script using friend id. Will you please tell me how to get information about this, basically i need to create clone site of http://www.ssfriendship.com that allows myspace user to login using their friend id. That site is getting top 10 users(by point) from myspace.com. I tried a lost but i am not getting any clue how to integrate our website with myspace so that i can do all functions that http://www.ssfriendship.com provides.

    I am in trouble. Please help me ASAP.

  53. Mr. X Says:

    Here’s a simple class that I’ve put together based on the original code. It can login and grab all the user’s friends. See the example at the end.

    class myspace
    {
    var $myID;
    var $token;
    var $pageSource;
    var $ch;

    function myspace() {
    $this->ch = curl_init();
    $randnum = rand(1,9999999);
    curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->dir_path.”/tmp/cookiejar-$randnum”);
    curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->dir_path.”/tmp/cookiejar-$randnum”);
    curl_setopt($this->ch, CURLOPT_USERAGENT,
    “Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) “.
    “Gecko/20071204 Firefox/2.0.0.3″);
    curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($this->ch, CURLOPT_POST, 0);
    }

    function newLocation($loc) {
    curl_setopt($this->ch, CURLOPT_URL, $loc.$this->token);
    curl_setopt($this->ch, CURLOPT_POST, 0);
    curl_setopt($this->ch, CURLOPT_USERAGENT,
    “Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) “.
    “Gecko/20071204 Firefox/2.0.0.3″);

    $this->pageSource = curl_exec($this->ch);
    }

    function login($email, $password) {
    curl_setopt($this->ch, CURLOPT_URL, “http://www.myspace.com”);
    $page = curl_exec($this->ch);

    preg_match(“/;MyToken=([^"]+)”/”,$page,$token);
    $token = $token[1];

    // Do login
    curl_setopt($this->ch, CURLOPT_URL,
    “http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken={$token}”);
    curl_setopt($this->ch, CURLOPT_REFERER, “http://www.myspace.com”);
    curl_setopt($this->ch, CURLOPT_HTTPHEADER,
    Array(“Content-Type: application/x-www-form-urlencoded”));
    curl_setopt($this->ch, CURLOPT_POST, 1);
    $postfields = “email=” . urlencode($email);
    $postfields .= “&password=” . urlencode($password);
    $postfields .= “&ctl00%24Main%24SplashDisplay%24login%24loginbutton.x=” .
    “38&ctl00%24Main%24SplashDisplay%24login%24loginbutton.y=15″;
    curl_setopt($this->ch, CURLOPT_POSTFIELDS,$postfields);
    $this->pageSource = curl_exec($this->ch);
    $old_token=$token;
    $token=NULL;
    preg_match(“/fuseaction=user&Mytoken=(.*)”/”, $this->pageSource, $token);
    $token = $token[1];
    $redirpage=”http://home.myspace.com/index.cfm?fuseaction=user&MyToken=$token”;

    // Do the redirect
    curl_setopt($this->ch, CURLOPT_REFERER,
    “http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken=$token”);
    curl_setopt($this->ch, CURLOPT_URL,$redirpage);
    curl_setopt($this->ch, CURLOPT_POST, 0);
    $page = curl_exec($this->ch);

    // Check login error
    if(strpos($page,”You Must Be Logged-In to do That!”) !== false){
    echo “Error: ” . $this->error_msg;
    exit;
    }

    // Logged in successfully
    else {
    // echo “Logged in successfully”;
    $this->newLocation(“http://home.myspace.com/index.cfm?fuseaction=user&Mytoken=”.
    $token);
    // echo $this->pageSource;

    // Find the user’s ID (becomes useful later)
    preg_match(“/”UserId”:(.*),”DisplayFriendId”/”, $this->pageSource, $id);
    $this->myID = $id[1];
    $this->token = “&MyToken=”.$token;
    }
    }

    function grabFriends() {
    $ms_f_url = “http://collect.myspace.com/index.cfm?”.
    “fuseaction=user.editfriends&friendID={$this->myID}”;
    $this->newLocation($ms_f_url);

    // First get the number of friend pages the user has, so we can loop through all of
    // them and grab all friends
    preg_match_all(“|(.*)|”,
    $this->pageSource, $pages);

    $num_pages = 1;
    if($pages[2][0]) $num_pages = $pages[2][count($pages[2])-2];

    for($i = 0; $i myID}&page={$i}”;
    $this->newLocation($ms_f_url);

    // We’re at the “Edit Friends” page, now grab each friend’s ID ([1]) and Name ([2])
    preg_match_all(“|&friendID=(.*)”>(.*)
    |”,
    $this->pageSource, $friendIDName);
    print_r($friendIDName[1]);
    print_r($friendIDName[2]);

    // Grab each friend’s image URL ([1])
    preg_match_all(“|pageSource, $images);
    print_r($images[1]);
    }
    }
    }

    ~

    Using it:

    $test = new myspace;
    $test->login(“[YOUR LOGIN]“, “[YOUR PASSWORD]“);
    $test->grabFriends();

  54. Mr. X Says:

    Well.. that didn’t work. Seems this site takes out some necessary pieces of code and I’m not sure how to work around this to post all the code in its entirety, especially with proper formatting. Click on my name to go to my website to get my e-mail if you want to e-mail me for the code.

  55. marie Says:

    This account has been locked out for 15 minutes due to excessive failed login attempts. Please try again what do i do if it keep saying that?

  56. Jarred Says:

    This seems like a great script, but its not showing anything when I try and run it. All I want to do is change the contents of the “about me” section on a daily basis using PHP and cron job processing. I can probably figure out my piece of it, but is there any chance someone could post an updated, working version?

    P.s. you guys rock

  57. mfk2007 Says:

    Hi,

    I am trying to login Hi5 via PHP/cURL, but to no avail. Can you help me out in this regard.

    I will be grateful.

    Thanks

    mfk2007

  58. xeugenex Says:

    i don’t understand any of this?!?
    I have the same problem. I can’t login into myspace even though I have put in the right username and password and it says “too many failed login attempts”. I’m really lost here with all these codes. Can you help me?

  59. vijay patidar Says:

    Hai i have code for logging into myspace but i want to post a photo into myspace after logging what code should i follow?
    pls help out.

    vijay

  60. Hitchhiker Nation Says:

    I Think, İt’s Very Nice…

  61. Babak Says:

    COOL !! , THANKS

  62. maqeulek Says:

    Does this script still work? I get the following error when trying to run it:

    Notice: Undefined offset: 1 in myspace.php on line 53

  63. sandhya Says:

    hi,
    i tried out ur myspace program and its working! could you plz help me out for yahoo and gmail? both yahoo and gmail are using ‘https’. your program works only for the websites that are using ‘http’!

  64. sohbet Says:

    You Thanks

  65. Ruthie Mckinney Says:

    hi
    kddigu0izitaqrm3
    good luck

  66. Nico Says:

    Searching for a solution where you can remotely update your css or layout in myspace. Will need to login using cUrl, but after that, can’t find anything pointing me in a direction where I can change the layout/css.

    Any help will be greatly appreciated.

  67. cbhost Says:

    Thanks a lot….Trying the same with twitter but the login token had me puzzled. Could see it being passed through headers but didn’t know where it was coming from…I see it on the page source so now I know I need to scrape it…thanks

  68. phpcoder Says:

    Please take out the god damn unicode quotes this code is shit.

  69. jaded_mate Says:

    I don’t believe this code is accurate anymore, Myspace might have changed their security. Is it possible to update the code? I’ve tooled around with it for awhile, but to no avail.

    Also, to the previous poster: Grow up :)

  70. Cord Says:

    I was wondering if it was possible to update this code. I keep trying to get it to work but I haven’t had any luck. Thanks.

  71. MyPlOkna Says:

    Если быть правильной, я бы порекомендовала установить Вам баттон “Дай 5 рублёв”,
    яб с удовольствием перевела владельцу 5 рублей. А вы? ;-)
    Окна пластиковые

  72. Sohbet Says:

    thank youu..

  73. Chat Says:

    Thank You Admin.

  74. Edencity Says:

    Thansk

  75. sohbet Says:

    hallo i wish you verry succes operator

  76. Alexnader Aigner Says:

    is the script still available?

  77. Mr.P Says:

    Hi Harry,
    I try to finding source code for cURL in google. Until I found it in your web site.This code is helpful me understand cURL process.by the way I try to re-write this code for hi5.com but I can not,I don’t know why.Can you re-write code for posting in hi5?
    Thank you for advance.

  78. Sohbet Says:

    hallo i wish you verry succes operator

  79. Sohbet Says:

    hallo dear friends thanks a lot for your workshop

  80. Haroon Says:

    I am running this script but i m getting this error. “malformed”

    Please tell me why it is showing error and not getting responce.

    Thanks

  81. islami chat Says:

    thank you very much my friends..

  82. Kodes Says:

    I have just undergone through the same evaluation process, really nice points have been covered.

    Thanks…

  83. Kodes Says:

    Nice Review, but i dont understand one thing why johnchow use google adsense to publish his ads, as he is very famous. I have seen his ads many time in my blog also…

  84. Kodes Says:

    Rory- Thanks! I appreciate comments like that.

    Jose- I’ve actually tried Amazon once or twice, but found I could make much more money with something like Adsense or YPN. Maybe it was my niche, but Amazon just didn’t pay very well for me. How is it working for you?

  85. Kodes Says:

    I am running this script but i m getting this error. “malformed”

    Please tell me why it is showing error and not getting responce

  86. Kodes Says:

    Thanks…

  87. Kodes Says:

    Review, but i dont understand one thing why johnchow use google adsense to publish his ads, as he is very famous. I have seen his ads many time in my blog also…

  88. Kodes Says:

    hard to believe that these employee evaluation quotes were really written on a Federal Government form. Such personal attacks on an employee could be construed as a form of harassment.

  89. Seth Says:

    I got the script to login to myspace, but I am trying to update my status(like on twitter)
    and cant for the life of my figure it out. I have googled it to death and read a lot of the posts on this site and still cant figure it out. Can this even be done? If so can someone through me a bone or point me in the right direction. Thanks

  90. Wesh Says:

    Hello. Awesome tutorial!
    Can I use CURL to get user’s details? I want to get my details from myspace, save them on an .xml file and then import it on a .swf file. I can’t get them with PHP. Can you tell me a possible solution?
    Thank you very much for this tutorial. :D

  91. chat sitesi Says:

    Nerdly (or anyone else with the solution), could you please share with us how you accomplished this? This is exactly what I am looking to do with one of my current sites.
    Thanks!

  92. sex shop Says:

    Thank you so much! I checked out the other two tutorials you’ve put up linked from digg and found them helpful, but this sealed it for me. Your site is now in my daily routine of places to check! Keep up the good work.