View news item by its ID.
GET http://url_to_your_hostbill.com/admin/api.php?api_id=API_ID&api_key=API_KEY&call=getNewsItem&id=ID
<?php include 'class.hbwrapper.php'; HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key'); $params = array( 'id'=>ID ); $return = HBWrapper::singleton()->getNewsItem($params); print_r($return); ?>
<?php $url = 'http://url_to_hb.com/admin/api.php'; $post = array( 'api_id' => API_ID, 'api_key' => API_Key, 'call' => 'getNewsItem', 'id'=>ID ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch); curl_close($ch); $return = json_decode($data, true); print_r($return); ?>
<?php /* Use this method to access HostBill api from HostBill modules */ $api = new ApiWrapper(); $params = array( 'id'=>ID ); $return = $api->getNewsItem($params); print_r($return); ?>
{ "success": true, "newsitem": { "id": "4", "title": "Lorem Ipsum", "content": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\r\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \r\nveniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea \r\ncommodo consequat. Duis aute irure dolor in reprehenderit in voluptate \r\nvelit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint \r\noccaecat cupidatat non proident, sunt in culpa qui officia deserunt \r\nmollit anim id est laborum.", "enable": "0", "date": "2011-09-29" }, "call": "getNewsItem", "server_time": 1317712618 }