1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

给帝国Cms 加上自动Ping!

本帖由 tension2009-03-30 发布。版面名称:源码讨论

  1. tension

    tension New Member

    注册:
    2007-07-14
    帖子:
    1,314
    赞:
    0
    首先打开 e/class/comdofun.php 1778行

    找到 //增加信息

    在上面加入

    PHP:
    include('xmlrpc.inc');
    // 控制ping服务
    function xmlrpc(){
    //xml-rpc ping service
        
    global $public_r;
        
    $url explode(","trim("http://blogsearch.google.com/ping/RPC2,http://blog.yodao.com/ping/RPC2")); //如果有多个就用逗号隔开
        
    $i 0;
        while (
    $url[$i]) {
            
    $uinfo parse_url($url[$i]);
            
    //XML-RPC客户端,见顶部调用
            //创建client对象, 三个参数依次为 path, hostname, port
            
    $s=new xmlrpc_client($uinfo['path'], $uinfo['host'], ($uinfo['port'] ? $uinfo['port'] : '80'));
            
    //创建xmlrpcval对象,将我们的PHP变量编码为XML-RPC需要的XML形式
            
    $parameters[0]=new xmlrpcval(urlencode($public_r[sitename]));
            
    $parameters[1]=new xmlrpcval($public_r[newsurl]);
            
    $parameters[2]=new xmlrpcval($public_r[newsurl]);
            
    $parameters[3]=new xmlrpcval($public_r[newsurl].'e/web?type=rss2&order=0&orderby=0');
            
    //尽管我们只有一个参数,但仍然要转换成数组的形式,因为xmlrpcmsg的第二个参数是一个参数表
            //创建XML-RPC报文,参数分别为 远程方法名 和 参数表
            
    $msg=new xmlrpcmsg('weblogUpdates.ping'$parameters);
            
    //发送报文,返回值$rsp为一个xmlrpcresp对象,它包含以下三个方法:
            //faultCode() 出错代码,如果成功将返回0
            //faultString() 出错信息
            //value() 返回值,以xmlrpcval对象形式存在,PHP使用前需要进行解码
            
    $rsp=$s->send($msg);
            
    //check for errors
            
    if($rsp->faultcode()==0) {
                
    //decode the response to a PHP type
                //xmlrpc_decode()函数用于将xmlrpcval对象解码
                
    $response=$rsp->value();
                
    //测试ping结果
                //print results
                //print '<pre>';
                //var_dump($response);
                //print '</pre>';
            
    } else {
                
    $pingres .= $uinfo['host'].'<br />';
            }
            
    $i++;
        }
    //ping end
    }
    再找到
    PHP:
    insert_dolog("classid=$add[classid]<br>id=".$id."<br>title=".$add[title]);//操作日志
    在下面加入 xmlrpc();

    下载附件上传至e/class/目录即可

    [​IMG] xmlrpc.inc.zip
     
  2. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
    我来测试
     
  3. tension

    tension New Member

    注册:
    2007-07-14
    帖子:
    1,314
    赞:
    0
    别忘了看apache日志 呵呵!
     
  4. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
    好像失败了我。
     
  5. 禾火木风

    禾火木风 New Member

    注册:
    2006-03-15
    帖子:
    2,212
    赞:
    8
    完善了没,等着
     
  6. tension

    tension New Member

    注册:
    2007-07-14
    帖子:
    1,314
    赞:
    0
    为什么失败了? 没上传文件?
     
  7. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
    传了。一切按照步骤。

    apache日志没有,google xml最新记录没有
     
  8. tension

    tension New Member

    注册:
    2007-07-14
    帖子:
    1,314
    赞:
    0
    怎么会呢...

    忘记了要设置网站地址为 http://

    这样的 不能用默认的/web/***的这样
     
  9. tension

    tension New Member

    注册:
    2007-07-14
    帖子:
    1,314
    赞:
    0
    203.208.60.147 - - [30/Mar/2009:12:19:43 +0800] "GET /robots.txt HTTP/1.0" 200 319 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
    203.208.60.147 - - [30/Mar/2009:12:19:44 +0800] "GET /demo/ecms/e/web?type=rss2&order=0&orderby=0 HTTP/1.0" 301 617 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
    203.208.60.147 - - [30/Mar/2009:12:19:52 +0800] "GET /demo/ecms/ HTTP/1.0" 200 3713 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
    203.208.60.147 - - [30/Mar/2009:12:19:54 +0800] "GET /demo/ecms/e/web/?type=rss2&order=0&orderby=0 HTTP/1.0" 200 1088 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"

    这几个蜘蛛确实是爬的 ECMS的
     
  10. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
    你有空了,再发一个文章试试
     
  11. tension

    tension New Member

    注册:
    2007-07-14
    帖子:
    1,314
    赞:
    0
    好的,我现在去再发一次,!
     
  12. tension

    tension New Member

    注册:
    2007-07-14
    帖子:
    1,314
    赞:
    0
    203.208.60.147 - - [30/Mar/2009:17:44:38 +0800] "GET /demo/ecms/e/web?type=rss2&order=0&orderby=0 HTTP/1.0" 301 617 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
    203.208.60.147 - - [30/Mar/2009:17:44:38 +0800] "GET /demo/ecms/ HTTP/1.0" 200 3713 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
    203.208.60.147 - - [30/Mar/2009:17:44:39 +0800] "GET /demo/ecms/e/web/?type=rss2&order=0&orderby=0 HTTP/1.0" 200 1125 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
    203.208.60.147 - - [30/Mar/2009:17:53:15 +0800] "GET /network-blog.html HTTP/1.0" 404 2100 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
     
  13. tension

    tension New Member

    注册:
    2007-07-14
    帖子:
    1,314
    赞:
    0
    绝对是可以用的,
     
  14. qlq

    qlq Active Member

    注册:
    2006-04-20
    帖子:
    2,658
    赞:
    1
    xmlrpc 不是用來離線寫博客的東西么? ...
     
  15. tension

    tension New Member

    注册:
    2007-07-14
    帖子:
    1,314
    赞:
    0
    我随便起了个名字而已!呵呵,本来想叫 autoping的
     
  16. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
    我再试试
     
  17. shangjay

    shangjay New Member

    注册:
    2006-01-13
    帖子:
    3,530
    赞:
    15
    tension 你把 comdofun.php 这文件也传上来吧啊。。。
     
  18. tension

    tension New Member

    注册:
    2007-07-14
    帖子:
    1,314
    赞:
    0
    我下载的5.1 GBK版
     
  19. tension

    tension New Member

    注册:
    2007-07-14
    帖子:
    1,314
    赞:
    0
    放到e/class
     

    附件文件:

  20. jaord

    jaord New Member

    注册:
    2006-04-18
    帖子:
    22
    赞:
    0
    Archive.zip 压缩包损坏