This tutorial assumes you are using any webserver with PHP5 installed and working properly.

Step 1: Enable the soap extension in your php.ini

If you downloaded pre-compiled platform binaries, they may have ext/soap compiled in but not loaded, so you'll need to update your PHP configuration to load ext/soap. Edit your php.ini, and look for the Dynamic Extensions section. Add a line (or removed the ';' in front), this will cause the extension to be loaded automatically.

SOAP Extension

  • On Windows: extension=php_soap.dll
  • On UNIX: extension=php_soap.so

If you haven't previously loaded any optional extensions, you may also have to set the extension_dir directive to point to the directory containing the extension libraries, including php_soap, for example: extension_dir="C:/php/ext/" (use forward slashes even on Windows)
Don't try to put directory information in the extension directive; use extension_dir if necessary.


Step 2: Paste the following code in a .php file (this is just an example)

 $url = "https://marineregions.org./rest/getGazetteerRecordsByName.json/Belgium/";
 $record = file_get_contents($url);
 $records =json_decode($record, true);
 echo "<table>";
 foreach($records as $record ){
	echo"<tr><td>MRGID</td><td>".$record["MRGID"]."</td> ";
	echo"<tr><td>Preferred gazetteer name</td><td>".$record["preferredGazetteerName"]."</td> ";
	echo"<tr><td>Preferred gazetteer name language type </td>
		 <td>".$record["preferredGazetteerNameLang"]."</td> ";
	echo"<tr><td>Place type </td><td>".$record["placeType"]."</td> ";
	echo"<tr><td>latitude </td><td>".$record["latitude"]."</td> ";
	echo"<tr><td>longitude </td><td>".$record["longitude"]."</td> ";
	echo"<tr><td>Place type </td><td>".$record["minLatitude"]."</td> ";
	echo"<tr><td>maximum latitude </td><td>".$record["maxLatitude"]."</td> ";
	echo"<tr><td>Place type </td><td>".$record["minLongitude"]."</td> ";
	echo"<tr><td>Place type </td><td>".$record["maxLongitude"]."</td> ";
	echo"<tr><td>precision </td><td>".$record["precision"]."</td> ";
	echo"<tr><td>gazetteer Source </td><td>".$record["gazetteerSource"]."</td> ";
	echo"<tr><td>status </td><td>".$record["status"]."</td> ";
	echo"<tr><td>accepted MRGID </td><td>".$record["accepted"]."</td> ";
	}
 echo "</table>";
	

Step 3: Run the script

It should return something like this:
MRGID14
Preferred gazetteer nameBelgium
Preferred gazetteer name language type English
Place type Nation
latitude 50.500749588013
longitude 4.477049946785
Place type 49.497299194336
maximum latitude 51.504199981689
Place type 2.5466001033783
Place type 6.4074997901917
precision 176337.31954733
gazetteer Source The Times comprehensive atlas of the world. 10th ed. Times Books: London, UK. ISBN 0-7230-0792-6. 67, 220, 124 plates pp.,
status standard
accepted MRGID 1920

[back]