<?php
$url='http://ip138.com/ips.asp?ip=127.0.0.1';
//file_get_contents()函数获取网页的html文档
$file=file_get_contents($url);//通过eregi()匹配获取想要的信息
eregi('<ul class="ul1">(.*)</ul>',$file,$rg);//建立一个新文件
//$newfile=fopen('ImitationIndex.htm','w');
//把内容读取进去
echo $rg[1],$ip
?>
上面的可以,下面的就不可以了,$_SERVER["REMOTE_ADDR"]明明可以获取实际的IP地址的,,<?php
$url='http://ip138.com/ips.asp?ip=$_SERVER["REMOTE_ADDR"]';
//file_get_contents()函数获取网页的html文档
$file=file_get_contents($url);//通过eregi()匹配获取想要的信息
eregi('<ul class="ul1">(.*)</ul>',$file,$rg);//建立一个新文件
//$newfile=fopen('ImitationIndex.htm','w');
//把内容读取进去
echo $rg[1],$ip
?>