<?php
header("content-type:text/html;charset=gb2312");
$ip=$_SERVER['REMOTE_ADDR'];
$result=@file_get_contents("http://www.youdao.com/smartresult-xml/search.s?type=ip&q=".$ip);
$arr=split("<ip>",$result);
$arr1=split("</location>",$arr[1]);
$arr2=split("</ip>",$arr1[0]);
$arr3=split("<location>",$arr1[0]);
if($arr2[0]==""||$arr3[1]=="")
	$result="未获取到您的ip信息,您的ip可能来自火星^_^";
else
	$result="<a href='/tools/ip/'>您的ip:".$arr2[0]."&nbsp;&nbsp;&nbsp;来自:".$arr3[1]."</a>";
echo "var arr=\"".$result."\"; ";
echo 'document.getElementById("myip1").innerHTML=arr;';
?>

