// Gather the stats all in one string. $file1 = file_get_contents("http://rscript.org/lookup.php?type=stats&user={$urlname1}"); // Separate the string into lines. (Split with \n as the delimiter) $fileLines = explode("\n", $file1); // For each line, foreach ($fileLines as $fileLine) { // Separate the line into tokens. (Split with ' ' as the delimiter) $data = explode(' ', $fileLine); // Add the tokens to the final array. The first token, which is the skill, // is to be associated with the rank, level and exp the user has in that // skill. $stats[$data[0]] = array($data[1], $data[2], $data[3]); } print_r($stats);