//return JSON array //exit(json_encode($apikey)); function logger($msg) { $file = "log.txt"; //$d=date(Y-m-d--H-i-s); $d = date("c"); file_put_contents($file, "{$d} - {$msg}\n", FILE_APPEND); } //Config script contains setup information. Required. include '/var/www/obdapi/config.php'; //db login info require 'phpGPX_JN.php'; //the code that generates the GPX XML file // a.) create instance of phpGoogleKML class $gps = new phpGPX(); $outputdir = "gpsexport/"; $gps->outputDirectory = $outputdir; $file = uniqid() . ".gpx"; $gps->filename = $file; //GPS parameters /* //Hardcoded inputs for debugging: $uid = 38; $apikey = P9wwTdj5P3o1Y195 //sample API $startdt = "2014-05-28 00:00:00"; $enddt = "2014-05-29 23:59:59"; $timezone_offset = 4; //UTC offset for your timezone. -4 is Eastern Standard Time. */ $apikey = $_POST['apikey']; $dtstart = $_POST['dtstart'];
<? require('phpGPX.php'); // a.) create instance of phpGoogleKML class $my = new phpGPX(); // b.) Change these properties only in case when you'd like to change default values (see documentation for default values). $my->filename = "test.gpx"; //$my->outputDirectory = "./export/"; // c.1) add Point(s) to your GPX file $my->addPoint("name2","cmrwe","swym","teype","des",42.000421,21.057541); $my->addPoint("name1","cmrdf","sywem","type","dewer2s",42.78777,21.052521); $my->addPoint("name4","cmry","symtr","tewrype","des",42.11251,21.744521); // or c.2) to add Line to GPX file // $my->addLinePlacemark(); // d.1) create GPX file $my->CreateGPXfile(); // d.2) or display GPX file //$my->DownloadGPXfile("TXT"); // d.3) or display GPX file //$my->DisplayGPXfile(); // HOWTO display phpGPX properties ? //echo $my->KML_name; //echo $my->KML_description; //echo $my->outputDirectory;