【问题标题】:How to connect to a Server using XML-RPC through a Proxy Server in Codeigniter如何通过 Codeigniter 中的代理服务器使用 XML-RPC 连接到服务器
【发布时间】:2015-10-22 09:22:55
【问题描述】:

我可以使用这个类连接到 XML-RPC 服务器:

$this->xmlrpc->server('http://www.sometimes.com/pings.php', 80);

现在,当带有客户端应用程序的服务器位于具有用户名和密码身份验证的代理后面时,我该如何修改上述类?

如果我正确理解 Codeigniter 文档 (http://www.codeigniter.com/user_guide/libraries/xmlrpc.html?highlight=xml%20rpc#CI_Xmlrpc),则必须将 Class 例如修改为如下所示:

$this->xmlrpc->server('http://www.sometimes.com/pings.php', 80, 'user:pass@proxy.com', 80);

很遗憾,这对我不起作用。

【问题讨论】:

    标签: php codeigniter proxy xml-rpc codeigniter-3


    【解决方案1】:

    先加载库:

    $this->load->library('xmlrpc');
    

    并尝试类似的方法:

    $this->xmlrpc->server('http://rpc.pingomatic.com/', 80);
    $this->xmlrpc->method('weblogUpdates.ping');
    
    $request = array('My Photoblog', 'http://www.my-site.com/photoblog/');
    $this->xmlrpc->request($request);
    
    if ( ! $this->xmlrpc->send_request())
    {
            echo $this->xmlrpc->display_error();
    }
    

    Sending XML-RPC Requests

    实际上我找不到为什么这不起作用。它清楚地指导我们应该做什么。

    【讨论】:

    • 库已加载,并且在我的本地 LAMP 堆栈上一切正常。现在我将站点移动到代理服务器后面的生产服务器,我总是得到响应:没有收到来自远程服务器的“200 OK”响应。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-29
    • 2014-06-27
    • 2017-04-04
    • 1970-01-01
    • 1970-01-01
    • 2020-10-12
    相关资源
    最近更新 更多