Just put any number of handles behind the URL, like this:
Notice: Undefined variable: url in /home/vhosting/k/vhost0002407/domains/manabase.com/htdocs/www/subdomains/topcoder/graph.php on line 11
$event) { $ratings[$handle][$date] = $event->rating; //$rounds[$handle][$date] = $event->roundId; } $minD = min (array_keys ($events[$handle])); $maxD = max (array_keys ($events[$handle])); $minR = min ($ratings[$handle]); $maxR = max ($ratings[$handle]); if (!isset ($minRating)) { $minDate = $minD; $maxDate = $maxD; $minRating = $minR; $maxRating = $maxR; } else { $minDate = min ($minDate, $minD); $maxDate = max ($maxDate, $maxD); $minRating = min ($minRating, $minR); $maxRating = max ($maxRating, $maxR); } } if (sizeof ($events) == 0) { die ("no rated coders specified"); } $minRating -= $minRating % 100; $minRating -= 50; $maxRating -= $maxRating % 100; $maxRating += 150; $minDate -= 60 * 60 * 24 * 14; $maxDate += 60 * 60 * 24 * 14; $width = 640; $height = 480; $image = svgCreate(); $dimensions = array ($minDate, $maxDate, $minRating, $maxRating); if ($maxRating >= 2200) { svgRectangle ($image, 0, rating ($maxRating), $width, rating (2200), false, 'red', 1.0, 0.2); } if (1500 <= $maxRating && $minRating <= 2200) { svgRectangle ($image, 0, rating (min (2200, $maxRating)), $width, rating (max (1500, $minRating)), false, 'yellow', 1.0, 0.2); } if (1200 <= $maxRating && $minRating <= 1500) { svgRectangle ($image, 0, rating (min (1500, $maxRating)), $width, rating (max (1200, $minRating)), false, 'blue', 1.0, 0.2); } if (900 <= $maxRating && $minRating <= 1200) { svgRectangle ($image, 0, rating (min (1200, $maxRating)), $width, rating (max (900, $minRating)), false, 'green', 1.0, 0.2); } if (0 <= $maxRating && $minRating <= 900) { svgRectangle ($image, 0, rating (min (900, $maxRating)), $width, rating (max (0, $minRating)), false, 'grey', 1.0, 0.2); } if ($minRating <= 0) { svgRectangle ($image, 0, rating (0), $width, rating ($minRating), false, 'orange', 1.0, 0.5); } for ($ratingLine = $minRating + 50; $ratingLine < $maxRating; $ratingLine += 100) { $y = rating ($ratingLine); svgLine ($image, 0, $y, $width, $y); svgText ($image, $ratingLine, $width + 5, $y + 5); } foreach (array (2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012) as $year) { foreach (array (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) as $month) { $x = timePos (mktime (0, 0, 0, $month, 1, $year)); if ($x < 0 || $x >= $width) continue; svgLine ($image, $x, 0, $x, $height, 'grey'); } $start = max (mktime (0, 0, 0, 1, 1, $year), $minDate); $end = min (mktime (0, 0, 0, 12, 31, $year), $maxDate); $x = timePos (($start + $end) / 2); if ($x >= 0 && $x < $width) { svgText ($image, $year, $x - 16, $height + 12); } $x = timePos (mktime (0, 0, 0, 1, 1, $year)); if ($x >= 0 && $x < $width) { svgLine ($image, $x, $height, $x, $height + 12, 'black'); } } svgRectangle ($image, 0, 0, $width, $height, 'black', false); foreach ($events as $handle => $graph) { drawGraph ($image, $graph, $graphColor[$handle]); } $x = 16; $y = $height + 32; foreach ($graphColor as $handle => $color) { svgText ($image, $handle, $x, $y, $color); $y += 16; } svgSend ($image); //print (htmlentities ($image)); die(); function getEvents ($handle) { $filename = 'graphFeeds/' . strtolower ($handle) . '.xml'; $mtime = @filemtime ($filename); if ($mtime && time() - $mtime < 3 * 60 * 60) { $dataFeed = file_get_contents ($filename); } else { $userId = getId ($handle); if ($userId === false) return false; $url= 'http://www.topcoder.com/tc?module=BasicData&c=dd_rating_history&cr='. $userId; $dataFeed = file_get_contents ($url); file_put_contents ($filename, $dataFeed); } global $parsrCharData, $parserEvents; $parserCharData = ''; $parserEvents = array(); $xmlParser = xml_parser_create(); xml_set_element_handler($xmlParser, "startElement", "endElement"); xml_set_character_data_handler($xmlParser, "characterData"); if (!xml_parse($xmlParser, $dataFeed, true /* final */)) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xmlParser)), xml_get_current_line_number($xmlParser))); } ksort ($parserEvents); if (@$_GET['timescale'] == 'matches') { $result = array(); $i = mktime (0, 0, 0, 1, 1, 2000); foreach ($parserEvents as $date => $event) { $result[$i] = $event; $i += 7 * 86400; } } else { $result = $parserEvents; } return $result; //return $parserEvents; } function startElement($parser, $name, $attrs) { global $parserCharData; $parserCharData = ''; } function endElement($parser, $name) { global $parserCharData; if ($name == 'DATE') { global $parserDate; $parserDate = parseDate ($parserCharData); } elseif ($name == 'CODER_ID') { global $parserCoderId; $parserCoderId = $parserCharData; } elseif ($name == 'NEW_RATING') { global $parserRating; $parserRating = $parserCharData; } elseif ($name == 'ROUND_ID') { global $parserRoundId; $parserRoundId = $parserCharData; } elseif ($name == 'SHORT_NAME') { global $parserRoundName; $parserRoundName = $parserCharData; } elseif ($name == 'ROW') { global $parserEvents, $parserDate, $parserRating, $parserRoundId; global $parserRoundName, $parserCoderId; $parserEvents[$parserDate] = new Event ($parserRoundId, $parserRoundName, $parserCoderId, $parserRating); } } function characterData($parser, $data) { global $parserCharData; $parserCharData .= $data; } function parseDate ($date) { list ($year, $month, $day) = sscanf ($date, "%d-%d-%d"); return mktime (0, 0, 0, $month, $day, $year); } class Event { var $roundId; var $roundName; var $coderId; var $rating; function Event ($roundId, $roundName, $coderId, $rating) { $this->roundId = $roundId; $this->roundName = $roundName; $this->coderId = $coderId; $this->rating = $rating; } } function drawGraph (&$image, $events, $color) { $xArray = array(); $yArray = array(); foreach ($events as $date => $event) { array_push ($xArray, timePos ($date)); array_push ($yArray, rating ($event->rating)); } svgPolyline ($image, $xArray, $yArray, $color); foreach ($events as $date => $event) { $x = timePos ($date); $y = rating ($event->rating); $rd = $event->roundId; $roundName = $event->roundName; $coderId = $event->coderId; $image .= "\n"; } } function timePos ($date) { global $width, $minDate, $maxDate; return $width * ($date - $minDate) / ($maxDate - $minDate); } function rating ($rating) { global $height, $minRating, $maxRating; return $height - 1 - $height * ($rating - $minRating) / ($maxRating - $minRating); } function mysql_escape($string) { //$string = str_replace('_', '\_', $string); $string = str_replace('%', '\%', $string); return $string; } function getId ($handle) { //print(urlencode(mysql_escape($handle))); $url = 'http://www.topcoder.com/tc?module=SimpleSearch&ha='. urlencode(mysql_escape($handle)); //print($url); $headers = get_headers($url); foreach ($headers as $header) { if (preg_match ('@^Location:.*cr=(\d+)$@', $header, $matches)) { return $matches[1]; } } return false; } ?>