这样一个功能如何实现?

@Ta 2014-08-24 1875点击
一个文件什么实现多个网址监控?
回复列表(4|隐藏机器人聊天)
  • @Ta / 2014-08-24 / /
    @黑豹传奇,用file_get_contents();或者curl
  • @Ta / 2014-08-24 / /
    这样可以??@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 / /
    @黑豹传奇
    <?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);
    ……
    ?>
    
  • HW
    @Ta / 2014-08-24 / /
    <?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;

    }
    }
     
    ?>
    这是@无道,以前发的,小白改了改
添加新回复
回复需要登录