All pastes #1538530 Raw Edit

Someone

public php v1 · immutable
#1538530 ·published 2009-08-22 04:21 UTC
rendered paste body
<?phpfunction getUpdates($id) {	$page = file_get_contents('http://store.steampowered.com/news/?filter=updates&appids=' . $id);	preg_match('#Product: <span class="filter_item">(.*?)</span>#', $page, $match);	$product = $match[1];	preg_match('#<!-- Center Column -->.*?<!-- End Center Column -->#s', $page, $match);	preg_match_all('#<a href="(.*?)" class="news_post_link">.*?</a></h2>.*?<h3>(.*?) -#s', $match[0], $match, PREG_SET_ORDER);	$count = 0;	$items = 0;	for ($i = 0; $i < count($match); $i++) {		$tmp = $match[$i];		if (strtotime($tmp[2]) < strtotime('-6 months')) {			break;		} else {			$count++;			preg_match('#<br><br>.*?</p>#s', file_get_contents($tmp[1]), $page);			if ($j = strpos($page[0], "<b>$product</b>")) $page[0] = substr($page[0], $j, strpos($page[0], '</ul>', $j) - $j);			$items += substr_count($page[0], '<li>');		}	}	echo "In the past 6 months, $product has had $count updates with a total of $items items.";}getUpdates($_GET['appid']);?>