All pastes #334694 Raw Edit

Unnamed

public php v1 · immutable
#334694 ·published 2007-01-31 20:23 UTC
rendered paste body
	function get($url, $proxy = false, $timeout=15, $headers=false) {		global $_CONF;		$user_agent = $_CONF['user_agent'];		$ch = curl_init();		if ($proxy)			curl_setopt($ch, CURLOPT_PROXY, $proxy);		if($headers)			curl_setopt($ch,CURLOPT_HTTPHEADER, $headers);		curl_setopt($ch, CURLOPT_URL, $url);		curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);		curl_setopt($ch, CURLOPT_USERAGENT, $user_agent[array_rand($user_agent)]);		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);		$content = curl_exec($ch);		$error = curl_error($ch);		curl_close($ch);		if($error) {			echo ' curl error '.$error.'<BR>';			flush();			return false;		}		else			return $content;	}