myspace mass friend delete?

i want to make a script to delete the 25,000+ friends as manual deletion has taken forever and i am still no where near done. i have a script to login to Myspace, and a friend help’d with some JavaScript to select the “select All” box, i am just unsure how i would go from logging in to the friends page without actually changing domains or pages. i figured an iframe or simular.

the following login script was not written by me.
[php]
class Myspace
{
function login($username, $password)
{
$username = $_POST[‘user’];
$password = $_POST[‘passwd’];

    $login_url = "https://secure.myspace.com/index.cfm?fuseaction=login.process";
    $post_data = "ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Email_Textbox=$username&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Password_Textbox=$password";
    
    $ch = curl_init($login_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $login_url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) ");
    curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);
    
	curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
	curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); 

    $result = curl_exec($ch);
    
    
    curl_close($ch);
    echo $result;
}

}

if(@$_POST[‘user’] && @$_POST[‘passwd’])
{
$login = new Myspace;

echo $login->login($_POST['user'],$_POST['passwd']);

}
else
{
echo
"







    </form>
    </body>
    </html>";

}
[/php]
and the java script to check the select all button.

for(i in a=documents.getElementsByTagName('input'))
  if(a[i].type="checkbox") a.checked = true;

You will have to curl the page you want

http://myspace.com/user/friends
after login and then make a script to to find the parts you need and auto click submit

so look in to curl more its not hard to curl a page
then make some code to press the submit button as you have the checkbox code all you need to do it summit for deletion

well i have modified my script to scrape the friends page and grab all 30 friend ID’s.
[php]

<?php class Myspace { function login($username, $password) { $username = $_POST['user']; $password = $_POST['passwd']; $login_url = "https://secure.myspace.com/index.cfm?fuseaction=login.process"; $post_data = "ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Email_Textbox=$username&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Password_Textbox=$password"; $ch = curl_init($login_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $login_url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) "); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); ob_start(); curl_exec($ch); ob_end_clean(); curl_close ($ch); unset($ch); $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_URL,"http://www.myspace.com/my/friends/"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_REFERER, 'http://www.myspace.com/home'); $buf2 = curl_exec ($ch); $start = strpos($buf2,'
'); $end = strpos($buf2,'
',$start); $table = substr($buf2,$start,$end-$start); preg_match_all("|data-id=(.*)>|",$table,$rows); foreach($rows[1] as $id){ $id = str_replace(">login($_POST['user'],$_POST['passwd']); } else { echo "

"; } ?>

[/php]

the major change being
[php]
$start = strpos($buf2,’

’);
$end = strpos($buf2,’
’,$start);
$table = substr($buf2,$start,$end-$start);
preg_match_all("|data-id=(.*)>|",$table,$rows);
foreach($rows[1] as $id){
$id = str_replace("><div",",",$id);
echo $id;
}
[/php]

now all i need help with is more curl i think. i read the man pages for curl and am now more lost then i was at first. i learn by example so often just reading man pages isn’t enough.

i know i need to remove the last comma, and format the string of IDs as such: friendIds=[Id’s here], and submit it to http://www.myspace.com/Modules/PageEditor/Handlers/My/DeleteFriends.ashx. the response should be {‘success": true’}.
i am sure the following will work to see if all went well, however not sure what i need to look at… like i said kinda lost now.
[php]
if(stristr(‘success": true’)) return true;
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service