标签:php httpwebrequest config zend-framework xml-rpc
我在谷歌搜索过,但没有人发布解决方案,他们都说在配置中设置超时,但你怎么做?
如何从XMLRPC客户端或服务器重置/覆盖此设置?
这是我正在尝试的:
$server = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc');
$client = $server->getProxy();
// Increasing the timeout
$client->setConfig(array('timeout'=>30));
这是错误:
Fatal error: Uncaught exception 'Zend_XmlRpc_Client_FaultException'
with message 'Method "setConfig" does not exist'
in /usr/share/php/libzend-framework-php/Zend/XmlRpc/Client.php:370
试图传递为arg:
$server = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc', array('timeout'=>30));
这是错误:
Catchable fatal error: Argument 2 passed to
Zend_XmlRpc_Client::__construct() must be an
instance of Zend_Http_Client
找到解决方案,这里是:
$server = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc');
// Get the HTTP Client used by the XMLRPC client
$http_client = $server->getHttpClient();
// Increasing the HTTP timeout
$http_client->setConfig(array('timeout'=>30));
$client = $server->getProxy();
One Line也适用于我:
$server = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc');
// Get the HTTP Client used by the XMLRPC client and increasing the HTTP timeout
$server->getHttpClient()->setConfig(array('timeout'=>30));
$client = $server->getProxy();
解决方法:
Zend documentation指定允许使用的配置参数.我猜你可以简单地将超时时间从10秒增加到20或30.无论什么适合你.
$client = new Zend_Http_Client('http://example.org', array('timeout' => 30));
要么:
$client->setConfig(array('timeout'=>30));
更新 – Zend_Http_Client由Zend_XmlRpc_Client使用.您可以通过Zend_XmlRpc_Client对象设置和访问Zend_Http_Client.
$xmlrpc_client = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc');
$xmlrpc_client->getHttpClient()->setConfig(array('timeout'=>30'));
我没有测试过这个,所以我不知道它会起作用,但你也可以使用setHttpClient()方法将你自己的Zend_Http_Client对象传递给Zend_XmlRpc_Client对象,如Zend documentation page for Zend_XmlRpc_Client底部所描述的那样(相当古怪).
标签:php,httpwebrequest,config,zend-framework,xml-rpc 来源: https://codeday.me/bug/20190713/1447957.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。