PHP Library
The PHP client library is used to add and remove points from the geocubes server and your map. Download this library and save it to your webserver. You can integrate this library directly into your application. Below you will see an example.

Support for the PHP Library has been discontinued. Please use the REST Interface to add and remove your points. It's also much faster!
complete example
<?php
	
	// require geocubes api class
	require_once("geocubesapi.class.php");
	
	
	/**
	* construct the geocubes object
	* You will find GEOCUBES_API_KEY and GEOCUBES_API_TOKEN
	* under "Manage Account" 
	**/
	
	$gc = new geocubes("GEOCUBES_API_KEY", "GEOCUBES_API_TOKEN");
	
	
	/**
	* For every point you want to add to geocubes and your map you
	* will need to give them an unique id. To simplify matters you can
	* use the id's you assigned for your data records in your database.
	**/

	$unique_id 	= 12345;		// 32 Bit unsigned Integer
	$latitude 	= 53.1337;		// Double
	$longitude	= 13.054999;		// Double
	$free_text	= "my keywords here";	// Limited to 255 Bytes
	$opt_field1	= 12;			// 32 Bit signed Integer
	$opt_field2	= 23;			// 32 Bit signed Integer
	
	
	/*
	* addPoint(int unique_id, double latitude, double longitude);
	* On success this function returns the unique id of the added geo point.
	* If an error occured it returns 0. You should log errors yourself, so you
	* can investigate these later.
	*/
	
	if ($gc->addPoint($unique_id, $latitude, $longitude, $free_text, $opt_field1, $opt_field2) == 0)
		printf("An error is occured\n");
	else
		printf("Geo Point with Id: %d, Lat: %.10f, Lng: %.10f,
				Text: %s, Field1: %d, Field2: %d added\n",
		$unique_id, $latitude, $longitude, $free_text, $opt_field1, $opt_field2);
	
	
	/*
	* removePoint(int unique_id);
	* On success it returns the unique id of the removed geo point.
	* If an error occured it returns 0.
	*/
	
/* remove this comment to try out removing this point
	if ($gc->removePoint($unique_id) == 0)
		printf("An error occured while removing geo point id: %d\n", $unique_id);
	else 
		printf("Geo point with Id: %d successfully removed\n", $unique_id);
*/
	
?>

geocubes constructor
function geocubes (string geocubes_key, string geocubes_token)
Description:
This is the central class of geocubes API. It contains all necessary functions to communicate with geocubes, to add points and remove points. First you need to call this constructor in your application.

Example:
// create geocubes object
$gc = new geocubes("GEOCUBES_API_KEY", "GEOCUBES_API_TOKEN");

if($gc->isAuth)
	printf("Everything ok\n");
Add geo-points
function addPoint (int $unique_id, double $latitude, double $longitude,
			string $free_text, int $opt_field1, int $opt_field2)
Description:
This function creates geo points on your map and save them on the geocubes server. The geo points will be added instantly to the geocubes database after you call this function.

Example:
	$unique_id 	= 12345;
	$latitude 	= 53.1337;
	$longitude	= 13.054999;
	$free_text	= "my keywords here";	// Limited to 255 Bytes
	$opt_field1	= 12;			// 32 Bit signed Integer
	$opt_field2	= 23;			// 32 Bit signed Integer
	
	/*
	* Returns the unique id of the geo point on success.
	* If an error occurs it returns 0.
	*/
	
	if ($gc->addPoint($unique_id, $latitude, $longitude, $free_text, $opt_field1, $opt_field2) == 0)
		printf("An error occured\n");
Notes:
The first parameter "unique_id" have to be an positive integer and unique.

Returns:
- returns Point ID on success
- returns 0 on error

Remove geo-points
function removePoint (int $unique_id)
Description:
Use this function to remove geo points.

Example:
	$unique_id 	= 12345;
	
	/*
	* Returns the unique id of the geo point on success.
	* If an error occurs it returns 0.
	*/
	
	if ($gc->removePoint($unique_id) == 0)
		printf("An error occured\n");
Returns:
- returns Point ID on success
- returns 0 on error