PHP
Download the last 25 messages in ERROR
This code snippet requires PHP version 5.2.0 or newer. No extra modules are required.
<?
$base_url = "https://www.babelway.net/SelfService3/rest/v2/";
$my_hub = 0; // You can find this on the My Account page :
$user = ""; // the username you use to connect to Babelway
$pwd = ""; // the password you use to connect to Babelway
// Download all your tickets for the month of July 2010
$from = mktime(0, 0, 0, 7, 1, 2010);
$to = mktime(23, 59, 59, 7, 31, 2010);
// Generate the URL for the tickets:
$url = $base_url . "hub-" . $my_hub . "/messages.json?since=" . $from . "&before=" . $to;
// Make the REST query
$context = stream_context_create(array(
'http' => array(
'method' => 'GET',
'header' => sprintf("Authorization: Basic %s\r\n", base64_encode($user.':'.$pwd))."\r\n",
'timeout' => 5,
),
));
$content = file_get_contents($url, false, $context);
// Decode the JSON
$data = json_decode($content);
// Display them
echo '<pre>';
print_r($data);
echo '</pre>';
?>