Welcome to this page where you will learn how to use the json rpc service. Don't worry, it's very easy and simple to implement.

Basically, this json rpc service has been created for the needs of my drupal's weather module : My main goal was to create a rpc service providing city weather codes. This would prevent users to create a big database on their server.

At this point, the database contains up to 35 000 airport/weather stations codes over the world.

This service will grow, but for now, it just provides a simple search functionality for countries or city names.

Download

Feel free to download the client sample with the jsonRPCClient library. It's just all you need to make searches easily.

How to search

Call a method to find city or country matching with 'bel'


require_once ('jsonRPCClient.php');

$weather = new jsonRPCClient('http://jsonrpc.deepbass.net/server.php?class=weather');

try {
	$list = $weather->search('bel');
	var_dump($list);
} catch (Exception $e) {
	echo nl2br($e->getMessage()).'
'."\n"; }

Response from the server

results showned below are the values received as results from the rpc service.

array(20) {
  ["BEXX0001"]=>
  string(20) "Belgium [Anderlecht]"
  ["BEXX0002"]=>
  string(13) "Belgium [Ans]"
  ["BEXX0003"]=>
  string(17) "Belgium [Antwerp]"
  ["BEXX0004"]=>
  string(18) "Belgium [Aywaille]"
  ["BEXX0005"]=>
  string(18) "Belgium [Brussels]"
  ["BEXX0006"]=>
  string(19) "Belgium [Charleroi]"
  ["BEXX0007"]=>
  string(21) "Belgium [Dendermonde]"
  ["BEXX0008"]=>
  string(14) "Belgium [Gent]"
  ["BEXX0009"]=>
  string(15) "Belgium [Halle]"
  ["BEXX0010"]=>
  string(17) "Belgium [Herstal]"
  ["BEXX0011"]=>
  string(15) "Belgium [Liege]"
  ["BEXX0012"]=>
  string(17) "Belgium [Lokeren]"
  ["BEXX0013"]=>
  string(18) "Belgium [Mechelen]"
  ["BEXX0014"]=>
  string(14) "Belgium [Mons]"
  ["BEXX0015"]=>
  string(15) "Belgium [Namur]"
  ["BEXX0016"]=>
  string(23) "Belgium [Saint-Nicolas]"
  ["BEXX0017"]=>
  string(20) "Belgium [Schaerbeek]"
  ["BEXX0018"]=>
  string(17) "Belgium [Seraing]"
  ["BEXX0019"]=>
  string(22) "Belgium [Sint-Niklaas]"
  ["BEXX0020"]=>
  string(19) "Belgium [Vilvoorde]"
}

© 2010 deepbass.net