i'm trying to do below client accessing
- Code: Select all
require_once 'Zend/Rest/Client.php';
$client = new Zend_Rest_Client('http://zf.localhost/api.php');
$client->updatePage();
$client->apiKey('test');
$client->id(1);
$client->name('ss');
$client->headline('ss');
$client->description('d');
$client->content('d');
echo '<pre>';
print_r($client->get());
echo '</pre>';
here rest server code
- Code: Select all
public function updatePage($apiKey, $id, $name, $headline, $description, $content)
{
if(!$this->_validateKey($apiKey)) {
return array('error' => 'invalid api key', 'status' => false);
}
// open the page
$itemPage = new CMS_Content_Item_Page($id);
// update it
$itemPage->name = $name;
$itemPage->headline = $headline;
$itemPage->description = $description;
$itemPage->content = $content;
// save the content item
$itemPage->save();
// return the page as an array, which Zend_Rest will convert into the XML response
return $itemPage->toArray();
}
when i access above client code i get below error
- Code: Select all
Fatal error: Uncaught exception 'Zend_Rest_Client_Result_Exception' with message 'REST Response Error: simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: ^' in C:\xampp\htdocs\owned\zf\library\Zend\Rest\Client\Result.php:61
Stack trace:
#0 C:\xampp\htdocs\owned\zf\library\Zend\Rest\Client.php(236): Zend_Rest_Client_Result->__construct(' <?xml version=...')
#1 C:\xampp\htdocs\owned\yuldi\test.php(14): Zend_Rest_Client->__call('get', Array)
#2 C:\xampp\htdocs\owned\yuldi\test.php(14): Zend_Rest_Client->get()
#3 {main}
thrown in C:\xampp\htdocs\owned\zf\library\Zend\Rest\Client\Result.php on line 61
Please help me how to fix this.

