Meerkat Service Example

Wire Service Channel :


No older than : Max hits :


Go! get News
No Data Loaded.

The Meerkat Example

Meerkat is a XML-RPC service which enables you to pull messages from their server from various news services.

This example uses vcXMLRPC to pull these messages from within your browser (no cgi involved).

Javascript Code

//Set up routing.
XMLRPC.routeServer = "http://www.vcdn.org/cgi-bin/rpcroute.cgi";

//Set up the Error handling.
XMLRPC.onerror = function(e){
   document.getElementById("RPCResult").innerHTML = "An Error has occured:<br><br><b>" +
   e.message + "</b><br><a href='help.php#errors'>Help about this error</a>";
   return true;
}

//Function that is called by GUI.
function pull(form){
   document.getElementById("RPCResult").innerHTML = "Wait... Loading data....";

   //prepare a 'struct' according to the Meerkat API.
   var oStruct = {
      channel : parseInt(form.channel.options[form.channel.selectedIndex].value),
      time_period : form.time.options[form.time.selectedIndex].value,
      ids : 0,
      descriptions : 150,
      categories : 0,
      channels : 0,
      dates : 1,
      dc : 0,
      num_items : parseInt(form.items.options[form.items.selectedIndex].text)
   };

   //Send Remote Procedure Call
   rpcCall(displayNews, "http://www.oreillynet.com/meerkat/xml-rpc/server.php", "meerkat.getItems", oStruct);

}

function displayNews(data){
   // make up the result as a nicely formatted link-list.

   if(data || data == ""){
      var sResult = '<UL>';
      for(var i=0; i<data.length; i++){
         sResult += '<LI>' + "<A HREF=" + data[i].link + " TARGET='_blank' TITLE=" +
         data[i].description + ">" + data[i].title + "</a>" + '<\/LI>';
      }
      sResult += '<\/UL>';

      document.getElementById("RPCResult").innerHTML = sResult;
   }

   return false;
}
 vcXMLRPC© 1999-2001 Virtual Cowboys  |  We thank our host: Helder Hosting