簡體   English   中英

如何通過 Codeigniter 中的代理服務器使用 XML-RPC 連接到服務器

[英]How to connect to a Server using XML-RPC through a Proxy Server in Codeigniter

我可以使用此類連接到 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 ),例如必須將類修改為如下所示:

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

不幸的是,這對我不起作用。

首先加載庫

$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();
}

發送XML-RPC請求

其實我找不到為什么那是行不通的。 因為它清楚地指導我們應該做什么

我讓它以下列方式拉動

// Make an object to represent our server.
$server = new xmlrpc_client('/api/sample.php','xmlrpc-c.sourceforge.net', 80);

// Set Proxy
$server->setProxy($proxyHost,$proxyPort,$proxyUsername='',$proxyPassword='',$proxyAuthType=1);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM