Code: Select all
<head>
<meta http-equiv="Content-Type" content="application/x-www-form-urlencoded">
</head>
<?
// setup and configure temp cookies
$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);
// get homepage for login page MyToken
curl_setopt($ch, CURLOPT_URL,"http://www.myspace.com");
$page = curl_exec($ch);
// find MyToken
preg_match("/MyToken=([^\"]+)\"/",$page,$token);
$token = $token[1];
// Print MyToken on-screen so we know we got it
echo $token;
// do actual login
$YOUR_EMAIL = "[color=#BF0000]youremail123+yahoo.com[/color]";
$YOUR_PASSWORD = "[color=#BF0000]yourpass123[/color]";
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 to home page
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);
// 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;
?>It freezes up at the final step, where its supposed to take us the myspace check-valid page which would in turn takes us to our logged in home page.
Ive even got it to show the MyToken and print it on the screen so we know we go it! Just need help of where I'm going wrong.