Skip to content

Instantly share code, notes, and snippets.

@KartikTalwar
Created October 16, 2012 16:32
Show Gist options
  • Save KartikTalwar/3900393 to your computer and use it in GitHub Desktop.
Save KartikTalwar/3900393 to your computer and use it in GitHub Desktop.
API Prof
<?php
$url = 'http://api.uwaterloo.ca/public/v1/?';
$url .= 'key=&service=staffinfo&q='.$q[0];
$get = file_get_contents($url);
$json = json_decode($get);
$data['name'] = $json->response->data->Name;
$data['dept'] = $json->response->data->Department;
$data['email'] = $json->response->data->Email;
$data['phone'] = $json->response->data->Phone;
$data['office'] = $json->response->data->Office;
foreach($data as $k => $v)
{
echo "<h4>".strtoupper($k)."</h4>\n";
echo "<h3 class='blue'>$v</h3>\n\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment