I've Googled everywhere but no one has posted a solution, they all say to set the timeout in the config but how do you do this?
How do I reset/override this setting from my XMLRPC client or server?
Here is what I'm trying:
$server = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc');
$client = $server->getProxy();
// Increasing the timeout
$client->setConfig(array('timeout'=>30));
Here is the error:
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
Trying to pass as arg:
$server = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc', array('timeout'=>30));
Here is the error:
Catchable fatal error: Argument 2 passed to
Zend_XmlRpc_Client::__construct() must be an
instance of Zend_Http_Client
Found the solution and here it is:
$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 works for me as well:
$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 specifies the configuration parameters that you are allowed to use. I would guess that you can simply increase the timeout from 10 seconds to 20 or 30. Whatever is appropriate for you.
$client = new Zend_Http_Client('http://example.org', array('timeout' => 30));
or:
$client->setConfig(array('timeout'=>30));
UPDATE - Zend_Http_Client is used by Zend_XmlRpc_Client. You can set and access the Zend_Http_Client via the Zend_XmlRpc_Client object.
$xmlrpc_client = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc');
$xmlrpc_client->getHttpClient()->setConfig(array('timeout'=>30'));
I haven't tested this so I don't know that it will work but you can also pass in your own Zend_Http_Client object to a Zend_XmlRpc_Client object using the setHttpClient() method as described (rather arcanely) at the bottom of the Zend documentation page for Zend_XmlRpc_Client.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With