简体   繁体   中英

Magento XML RPC Error

I have created an XML-RPC User and I've assigned a role (with all resources) from admin panel: System/Web Services/XML-Rpc Users and Roles.

Now I want to dump all cart products and send them to an external server.

I'm using this code in app/design/frontend/default/theme/template/catalog/product/view.phtml:

$client = new Zend_XmlRpc_Client('http://mysite/api/xmlrpc/', 80);
$session = $client->call('login', array('myuser', 'myapi'));
$filterData = array('type' => array('in' => 'simple'));
$product = $client->call('call', array($session, 'category_product.list', array($filterData)));
var_dump($product);
$server = new Zend_XmlRpc_Client('/xmlServer.php','www.server-site.com', 80);
$result = $server->send($product); 

The problem is that I receive this error:

Fatal error: Call to a member function getUri() on a non-object in /var/www/html/zzz/lib/Zend/XmlRpc/Client.php on line 265 

This is the code from line 265:

if($http->getUri() === null) {
        $http->setUri($this->_serverAddress);
    }

I think that the problem comes from here:

$session = $client->call('login', array('myuser', 'myapi'));

But the user and api are valid. So I don't know what could it be. What is wrong in my code?

Anticipated thanks!

The problem is my server configuration. It returns false if I try this php command: file_get_contents So host can't be accessed on port 80. It's because of the firewall or some other settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM