PHP Example

Hi Robert,

I eventually used file_get_contents(). Sierra Wireless also sent me the PHP code from the AWS server for reference but I’d already solved my initial issue. I tried various PHP curl techniques but none worked for me.

My proof of concept code lists some device properties:

<?php

$HOST = "https://eu.airvantage.net";
$endpoint = $HOST."/api/oauth/token";

$json = file_get_contents('https://eu.airvantage.net/api/oauth/token?grant_type=password&username=ABC@DDDDD.CCCC&password=PPPPPP&client_id=IIIIIIIIIIIIIIIIIIIIIIIIIIIII&client_secret=SSSSSSSSSSSSSSSSSSSSSSSS');
$obj = json_decode($json);

$url='https://eu.airvantage.net/api/v1/systems?access_token='.$obj->access_token;
//echo $url;
$json = file_get_contents($url);
$o = json_decode($json);
//echo $json;
echo "Your Devices (name, UID & first label):<br>";

echo "<table width=60% border=1><tr><th>Device</th><th>Uid</th><th>Owner</th></tr>";
for ($i = 0; $i < $o->count; $i++) {
        echo "<tr>";
        echo "<td>". $o->items[$i]->type . "</td><td>" . $o->items[$i]->uid . "</td><td>". $o->items[$i]->labels[0] ."</td>";
        echo "</tr>";
}
echo "</table>";
?>

Thanks,
Steve