<page>' . ($pager->getCurrentPage() - 1) .'</page>
<groupings>
<groupby attr="d" mode="flat" groups-on-page="15" docs-in-group="1" />
</groupings>
</request>';
$client->setRawData($xml);
$response = $client->request(Zend_Http_Client::POST);
$xml = $response->getBody();
/**_
* Parse xml
*/
$res = $this->_parseXml($xml);
$pager->setCountRecords($res['total']);
$this->view->assign('result', $res);
$this->view->assign('pager', $pager);
$this->view->assign('searchString', $this->getRequest()->getParam('search'));
}
}
private function _parseXml($xml)
{
$xml = str_replace('<hlword>', '|strong|', $xml);
$xml = str_replace('</hlword>', '|/strong|', $xml);
$xmlElement = new SimpleXMLElement($xml);
$total = $xmlElement->xpath("//response//results//found[@priority='all']");
$res['total'] = $total[0];
if ($res['total'] <= 0) {
return false;
}
$page = $xmlElement->xpath("//response//results//page");
list($from, $to) = $page[0]->attributes();