All pastes #941175 Raw Edit

Mine

public text v1 · immutable
·published 2008-03-13 15:24 UTC
rendered paste body
<?PHP
use with:

echo site_status("gamespot.com", "GameSpot:Video Games PC PlayStation 2 Xbox 360 Wii PS3 GameCube PSP DS GBA PS2 PlayStation 3") 


function site_status($site, $title);
$site = browse($site);
if(input_match($site, 1, '<title>', '</title>') != $title)
{
    return "$site is unavailable";
}else
    {
       return "$site is available";
    }
function input_match($source, $num, $preg, $preg1) {
	$parts = explode($preg, $source);
	$parts = explode($preg1, $parts[$num]);
	$var = $parts[0];
	return $parts[0];
}
function browse($url) {
	$ch = curl_init();
	curl_setopt ($ch, CURLOPT_URL, $url);
	curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
	curl_setopt ($ch, CURLOPT_TIMEOUT, '10');
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
	$store = curl_exec ($ch);
	return $store;
}
?>