Fullscreen on/off iPad Touch Mobile

Sample PHP client

The following sample PHP code demonstrates querying the IvyRoot API and generating a Google charts sparkline from the data. Not that you’d need to use Google Charts of course ;-)
You will of course need to change the username and password.

<?php
function getRequestVar($key,$request)
{
  $v = "";
  if (array_key_exists($key,$request))
  {
    $v = trim($request[$key]);
  }
  return $v;
}
$measure =getRequestVar('measure',$_REQUEST);
$url = "http://api.ivyroot.com/api/measures/" . $measure;
$session = curl_init($url);
$username = "api";
$password = "api";
unset($hdrarray);
$hdrarray[] = "Authorization: Basic " . base64_encode($username.':'.$password);
curl_setopt($session, CURLOPT_HTTPHEADER, $hdrarray);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
$data = json_decode($response);
$chartlink = "http://chart.apis.google.com/chart?chs=200x125&cht=ls&chco=0077CC&chd=t:";
$values = $data->values;
foreach ($values as $v)
{
  $chartlink .= $v[1] . ",";
}
$chartlink = substr($chartlink,0,-1);
echo "<img src='" . $chartlink . "' alt='" . $chartlink . "'/>";
?>