已掉线,重新登录

首页 > 绿虎论坛 > 历史版块 > 编程 > PHP > 讨论/求助

标题: 这样一个功能如何实现?

作者: @Ta

时间: 2014-08-24

点击: 1878

一个文件什么实现多个网址监控?

[隐藏样式|查看源码]


『回复列表(4|隐藏机器人聊天)』

1. @黑豹传奇,用file_get_contents();或者curl
(/@Ta/2014-08-24 10:06//)

2. 这样可以??@skyxi

<?php
require "utf8.php";
$ip = "http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
$ip1 = str_replace("curl","g_ut",$ip);
file_get_contents($ip1);
$ip2 = str_replace("curl","taotao",$ip);
//file_get_contents($ip2);
//fclose(fopen($ip1,"r"));
$ip3 = str_replace("curl","all",$ip);
//file_get_contents($ip3);
//fclose(fopen($ip1,"r"));
echo "系统已经执行!";
?> 
(/@Ta/2014-08-24 10:41//)

3. @黑豹传奇
<?php
set_time_limit(0);//如果不支持就换成下面个。
 //ini_set(“max_execution_time”, “1800″);
$url1=xx;
$url2=xx;
file_get_contents($url1);
file_get_contents($url2);
?>
//频繁使用file_get_contents();可能比较耗资源
可以用snoopy类,我前几个帖子里有附件,这样用
<?php
require "snoopy.class.php";
$h=new snoopy;
$h->fetch($url);
$h->fetch($url2);
……
?>
(/@Ta/2014-08-24 12:08//)

4. <?php
ignore_user_abort(true);
function wd($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
}
$u1='网址1';
$u2='网址2';
$u3='网址3';


for($i=1;$i<=3;$i++){
switch($i)
{
case 1: wd($u1); break;
case 2: wd($u2); break;
case 3: wd($u3); break;

}
}
 
?>
这是@无道,以前发的,小白改了改
(/@Ta/2014-08-24 12:34//)

回复需要登录

9月6日 14:06 星期六

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1