/**
 * get release-list
 *
 * @return release-list as html-snip
 */
function getReleaseList()
{
    global $cfg, $error;
    $retVal = "";
    $releaseList = gzinflate(getDataFromUrl(_SUPERADMIN_URLBASE . _SUPERADMIN_PROXY . "?a=3"));
    if (isset($releaseList) && $releaseList != "") {
        $retVal .= '<strong>Available Tarballs : </strong>';
        $retVal .= '<br>';
        $retVal .= '<table cellpadding="2" cellspacing="1" border="1" bordercolor="' . $cfg["table_border_dk"] . '" bgcolor="' . $cfg["body_data_bg"] . '">';
        $retVal .= '<tr>';
        $retVal .= '<td align="center" bgcolor="' . $cfg["table_header_bg"] . '">&nbsp;</td>';
        $retVal .= '<td align="center" bgcolor="' . $cfg["table_header_bg"] . '"><strong>Version</strong></td>';
        $retVal .= '<td align="center" bgcolor="' . $cfg["table_header_bg"] . '"><strong>Checksum</strong></td>';
        $retVal .= '</tr>';
        $releaseListFiles = explode("\n", $releaseList);
        foreach ($releaseListFiles as $release) {
            $release = trim($release);
            if (isset($release) && $release != "") {
                $releaseVersion = substr(array_pop(explode("_", $release)), 0, -8);
                $retVal .= '<tr>';
                $retVal .= '<td align="center">';
                $retVal .= '<a href="' . _SUPERADMIN_URLBASE . 'files/' . $release . '">';
                $retVal .= '<img src="images/download_owner.gif" title="Download ' . $releaseVersion . '" border="0">';
                $retVal .= '</a>';
                $retVal .= '</td>';
                $retVal .= '<td align="right">';
                $retVal .= '<a href="' . _SUPERADMIN_URLBASE . 'files/' . $release . '">';
                $retVal .= $releaseVersion;
                $retVal .= '</a>';
                $retVal .= '</td>';
                $retVal .= '<td align="right">';
                $retVal .= '<a href="' . _SUPERADMIN_URLBASE . 'files/' . $release . '.md5">';
                $retVal .= 'md5';
                $retVal .= '</a>';
                $retVal .= '</td>';
                $retVal .= '</tr>';
            }
        }
        $retVal .= '</table>';
    }
    return $retVal;
}
 *
 * @return $data
 */
function getDataFromUrl($url, $accessToken)
{
    //send OAUTH2 request
    $data = json_decode(sendOauth2Request($url, $accessToken), true);
    //if error code M03140300 is returned then new access token is fetched then one more request is sent to server using the new access token
    if (isset($data['code']) && $data['code'] == 'M03140300') {
        $accessToken = getOauth2AccessToken(true);
        $data = json_decode(sendOauth2Request($url, $accessToken), true);
    }
    return $data;
}
/**
 * Clear access token session variables
 *
 */
function clearAccessTokenSession()
{
    if (isset($_SESSION['access_token']) && isset($_SESSION['access_token_expiration_time'])) {
        unset($_SESSION['access_token']);
        unset($_SESSION['access_token_expiration_time']);
    }
}
//get vehicle data from API
$accessToken = getOauth2AccessToken();
$result = getDataFromUrl("http://api.autodata-group.com/v1/vehicles/AUD00528?country-code=gb", $accessToken);
//print response
echo '<pre>';
print_r($result);