2013-04-17 45 views
0

我已經創建了一個XML-RPC用戶,並且已經從管理面板中指定了一個角色(包含所有資源):System/Web Services/XML-Rpc Users and Roles。Magento XML RPC錯誤

現在我想轉儲所有購物車產品並將它們發送到外部服務器。

我使用在app /設計/前端/默認/主題/模板/目錄/產品上的代碼/ 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); 

的問題是,我收到此錯誤:

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 

這是來自線265代碼:

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

我認爲這個問題來自這裏:

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

但是用戶和API是有效的。所以我不知道它會是什麼。 我的代碼有什麼問題?

預期的感謝!

回答

1

問題是我的服務器配置。 如果我嘗試這個php命令,它將返回false:file_get_contents 因此,主機無法在端口80上訪問。 這是因爲防火牆或其他設置。