PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Rafael Santiago   Weather.com API Class   sample.php   Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Example
Class: Weather.com API Class
Retrieve weather conditions using Weather.com API
Author: By
Last change:
Date: 13 years ago
Size: 592 bytes
 

Contents

Class file image Download
<?php
/**
 *
 * Weather Class usage
 *
 * @see http://www.weather.com
 * @author Rafael Santiago
 * @since 19/07/2010
 *
 */
 
require_once("Weather.class.php");

// CONFIG
$locId = "BRXX0037"; // LOCATION ID IN WEATHER.COM
$partnerId = '9999999999'; // PARTNER ID IN WEATHER.COM
$key = 'xxxxxxxxxxxxxxxx'; // ACCESS KEY

// INSTANCE
$objWeather = new Weather($locId, $partnerId, $key);

// ONLY ONE VALUE
echo $objWeather->getResult('TEMPERATURE');

// MULTIPLE VALUES
var_dump($objWeather->getResult(array('TEMPERATURE','WINDSPEED','WINDDIRECTION')));
?>