';
// Initialise cURL.
$curl = curl_init();
//curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// Get their profile page (to get their ID).
echo '
Retrieving profile... ';
curl_setopt($curl, CURLOPT_URL, 'http://myspace.com/' . $_POST['url']);
curl_setopt($curl, CURLOPT_POST, 0);
$result = curl_exec($curl);
$headers = curl_getinfo($curl);
// Is it private?
if (strpos($result, 'This profile is set to private'))
{
echo 'Error: Your profile is set as private. Currently, private profiles are not supported by this script.';
return false;
}
echo 'Done, took ', $headers['total_time'], ' seconds. ';
// Get their ID.
//if (!preg_match('/fuseaction=user\.viewfriends&friendID=([0-9]+)">/', $result, $matches))
if (!preg_match('/fuseaction=user\.viewfriends&friendID=([0-9]+)">/', $result, $matches))
{
echo 'Error: Could not retrieve friend ID! Please report this to myspace@daniel15.com. Be sure to mention your URL in the email.';
print_r($matches);
//echo $result;
return false;
}
$id = $matches[1];
unset($matches);
echo 'Your Friend ID is ', $id, '. ';
// Retrieve friends page.
echo 'Checking friends list... ';
curl_setopt($curl, CURLOPT_URL, 'http://friends.myspace.com/index.cfm?fuseaction=user.viewfriends&friendID=' . $id);
curl_setopt($curl, CURLOPT_POST, 0);
$result = curl_exec($curl);
$headers = curl_getinfo($curl);
// Find out how many pages there are.
preg_match('/