View file func_telinfo.php

File size: 1.07Kb
<?php
// получение страницы
function get_xml($url)
{
	$url=stripslashes($url);
	$url=str_replace("\"","",$url);
	$user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; ru) Opera 8.01";
	$result=array();
	if($url!="")
	{
	$ch=curl_init();
	curl_setopt($ch,CURLOPT_URL,$url);
	curl_setopt($ch,CURLOPT_USERAGENT,$user_agent);
	curl_setopt($ch,CURLOPT_HEADER,0);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	$result['page']=curl_exec($ch);
	$result['http_code']=curl_getinfo($ch,CURLINFO_HTTP_CODE);
	curl_close($ch);
	}
	else
	{
		$result['page']="";
		$result['http_code']=404;
	}
	return $result;
}
$nname="";
$opentag="";
function startElement($parser,$name,$attrs)
{
	global $nname,$opentag;
	$opentag=true;
	$nname=$name;
}
function endElement($parser,$name)
{
	global $opentag,$nname;
	$opentag=false;
}
function CharacterData($parser,$data)
{
	global $nname,$opentag;
	global $telinfo_array,$data_xml_tag;
	$data=trim($data);
	$data=preg_replace("/\s\s+/"," ",$data);
	if($opentag) if(isset($data_xml_tag[$nname])) $telinfo_array[$data_xml_tag[$nname]]=$data;
}
?>