View file example.php

File size: 1.69Kb
<?php

				#################						Автор: redmal								#############
				######################				Сайт: http://srcblog.ru						####################
			############################			[email protected]							###########################
	header("Content-type: text/xml; charset=utf-8");
	$type_info = (isset($_GET['type_info']) and !empty($_GET['type_info'])) ? trim($_GET['type_info']) : 'list_brands';
	
	class PhoneInfo
	{
		function getUrlContent($url)
		{
			if( $curl = curl_init() ) 
			{
				curl_setopt($curl, CURLOPT_URL, $url);
				curl_setopt($curl, CURLOPT_HEADER, 0);
				curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
				curl_setopt($curl, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
				curl_setopt($curl, CURLOPT_REFERER, 'http://projects.srcblog.ru');
				$out = curl_exec($curl);
				curl_close($curl);
				return $out;
			}
		}
	}
	/*		Примеры страниц с информацией	*/
	$url['list_brands'] = 'http://projects.srcblog.ru/PhoneInfo/api.php?type_info=list_brands';
	$url['list_devs'] = 'http://projects.srcblog.ru/PhoneInfo/api.php?type_info=view_list_devs&id_brand=1';
	$url['view_specs'] = 'http://projects.srcblog.ru/PhoneInfo/api.php?type_info=view_specs&brand=1&model=galaxynote3(n9000)'; 
	
	if(isset($url[$type_info]))
	{
		$phone_info = new PhoneInfo;
		echo $phone_info->getUrlContent($url[$type_info]);
	}
	
				#################						Автор: redmal								#############
				######################				Сайт: http://srcblog.ru						####################
			############################			[email protected]							###########################
	
?>