| 
<?php
/*
 example usage
 weatherStack ver 1.0
 
 You must get an API key from https://weatherstack.com/product
 and enter it in the weatherstack.class.php file
 */
 
 //turning off low level notices
 error_reporting(E_ALL ^ E_NOTICE);
 
 //instantiate the class
 include('weatherstack.class.php');
 $weather = new weatherStack();
 
 //set the end point to use
 //free plan uses the 'current' endpoint
 //we can set it with 'current' or 'c' shorthand
 $weather->setEndPoint('c');
 
 //set the query parameter
 $weather->setParam('query','New York');
 
 //optionally set the units
 $weather->setParam('units','f');
 
 //get the response
 $weather->getResponse();
 
 //show specific response data
 echo 'The current temperature in '.$weather->response->location->name.', '
 .$weather->response->location->region.' is '
 .$weather->response->current->temperature
 .' degrees ('.$weather->response->request->unit.')';
 
 echo '<hr>';
 
 //displaying the full response
 echo '<pre>';
 var_dump($weather->response);
 echo '<pre>';
 
 /*
 Premium plans are available that allow access to more endpoints.
 You can see what is available at https://weatherstack.com/product.
 */
 ?>
 
 |