<?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
?>
$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
?>
解决方案 »
- 如何取得这样的参数呢?希望URL的形式是www.xxx.com/aaa/?para1
- 求助关于IP隐藏的代码:!!!!
- 关于substr_count方法的错误
- php换将配置总是不能出现mysql的信息,为什么?
- 关于模板替换 执行效率的问题
- 就这么一块代码,怎么就没人改对呢?请大家帮忙.我给20分啊!
- 求一个图片地址表示的正则表达式的写法!
- 要实现这个的SQL语句怎么写?
- 谁能提供一个phpmyadmin中文的下载呀
- php+access日期问题,大家帮帮忙啊,高分相送!!!!!
- $_POST['adddata']能有结果,$_POST['adddata']+1也正确,但和日期相加就不对了,请帮忙
- 有没有 关于PHP 实例项目开发的书 就是教 各种项目原理的 那种书
$url='http://ip138.com/ips.asp?ip=' . $_SERVER["REMOTE_ADDR"];