Exemple #1
0
<?php

/*
Script: vg_dropfile.php
        Convert a track to a JSON format
License: GNU General Public License
This file is part of VisuGps
VisuGps is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
VisuGps is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with VisuGps; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Copyright (c) 2007-2008 Victor Berchet, <http://www.victorb.fr>
*/
require_once 'vg_cfg.inc.php';
require_once 'vg_tracks.php';
$content = file_get_contents("php://input");
$activity = buildActivityFromContent($content);
$jsTrack = buildJsonTrack($activity->trackData);
echo @json_encode($jsTrack);
Exemple #2
0
function buildActivity($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FAILONERROR, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    $file = curl_exec($ch);
    curl_close($ch);
    return buildActivityFromContent($file, $url);
}