function profile($INstart,$INend) { $maxtries = 15; for ($i = 0; $i < $maxtries; $i++) { // Define the URL we'll be pulling from $URL = "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=".mt_rand(100, 126563186).""; // Grab the full contents of the web page, 8192 bytes at a time until done $file = fopen("$URL", "r"); $r = ""; while (!feof($file)) { $r .= fread($file, 8192); } $Start = $INstart; $End = $INend; // Grab the text between the Start & End location and define variable $stuff = eregi("$Start(.*)$End", $r, $content); $Section = $content[1]; $Check = strip_tags($content); // Check for blank scrapes, and echo content or rescrape if (!empty($Check)) { return $Section } } return "Exhausted."; }