Ejemplo n.º 1
0
    //foreach($lines as $line) {
    //$colon = strpos($line, ':');
    //if($colon !== false) {
    //$name = trim(substr($line, 0, $colon));
    //$value = trim(substr($line, $colon + 1));
    ////Actually sometimes there are two "Link" Elements, we need the first one
    //if(!array_key_exists($name, $parsed)) $parsed[$name] = $value;
    //}
    //}
    ////parse the number of tracks from the "Link"-Headers
    //$num_of_tracks = 0;
    //if(array_key_exists('Link', $parsed)){
    //$num_of_tracks = explode(">",explode( "page=", $parsed['Link'])[1])[0];
    //}
    //$response = array("status" => $http_status, "response" => $num_of_tracks, "url" => $lastUrl);
    $response = get_request_with_headers($serverurl . "/users/" . rawurlencode($_SESSION['name']) . "/tracks/?limit=1&page=0", true);
    if ($response['status'] == 200) {
        echo processTrackNumberResponse($response);
    } else {
        echo $response['status'];
    }
}
if (isset($_GET['track'])) {
    $response = get_request($baseURL . '/users/' . rawurlencode($_SESSION['name']) . '/tracks/' . rawurlencode($_GET['track']), true);
    if ($response['status'] == 200) {
        echo $response['response'];
    } else {
        echo $response['status'];
    }
}
if (isset($_GET['atrack'])) {
Ejemplo n.º 2
0
<?php

/*
* This file is part of enviroCar.
* 
* enviroCar 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 3 of the License, or
* (at your option) any later version.
*
* enviroCar 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 enviroCar.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'connection.php';
require_once 'config.php';
$resp = get_request_with_headers($serverurl . "/tracks/?limit=1&page=0", false);
echo processTrackNumberResponse($resp);