Location: PHPKode > scripts > PHP Fetch > php-fetch/phpfetch.php
<?
class PHPFetch {
	var $classes;
	var $infos;
	function fetch_phpclasses($id) {
		$data = file("http://www.phpclasses.org/browse/author/$id.html");
		echo "<br>";
		foreach ($data as $id2 => $line) {
			if (eregi("<a href=\"/browse/package/([0-9]{1,4}).html\">(.+)</a>",$line,$ar)) {
				$this->classes[] = array("pkg" => $ar[1], "name" => $ar[2]);
			}
			elseif (eregi("<TH ALIGN=right WIDTH=\"1%\" NOWRAP><!--htdig_noindex-->(.+)<!--/htdig_noindex-->:</TH>",$line,$ar)) {
				if ($ar[1] != "Name") {
					$cinfo = $ar[1];
				}
			}
			elseif (eregi("<TD NOWRAP>(.+)</TD>",$line,$ar) and $cinfo) {
				switch ($cinfo) {
					case "Published packages":
						$this->infos[$id]["pkgs"] = $ar[1];
						break;
					case "Age":
						$this->infos[$id]["age"] = $ar[1];
						break;
					case "Country":
						$this->infos[$id]["country"] = eregi_replace("</a>","",eregi_replace("<a href=\"(.+)\">","",$ar[1]));
						break;
					case "Home page":
						$this->infos[$id]["hpage"] = eregi_replace("<(/{0,1})tt>","",eregi_replace("<!--/htdig_noindex-->","",eregi_replace("<!--htdig_noindex-->","",$ar[1])));
						break;
					case "All time rank":
						$this->infos[$id]["arank"] = $ar[1];
						break;
					case "Week rank":
						$this->infos[$id]["wrank"] = $ar[1];
				}
				unset($cinfo);
			}
		}
		return(0);
	}
}
$c = new PHPFetch;
$c->fetch_phpclasses("136944");
print_r($c->classes);
print_r($c->infos);
?>
Return current item: PHP Fetch