Login   Register  
PHP Classes
elePHPant
Icontem

File: Services/weather.example

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Leonardo Branco Shinagawa  >  Feedee  >  Services/weather.example  >  Download  
File: Services/weather.example
Role: Example script
Content type: text/plain
Description: Weather Example
Class: Feedee
Retrieve and parse RSS feed from remote sites
Author: By
Last change:
Date: 2010-12-17 09:47
Size: 881 bytes
 

Contents

Class file image Download
<?php

/* EXAMPLE */

$weather = new Feedee('weather');
$weather->setPartnerId('9999999999');
$weather->setLicenseKey('x999999x99xxxx9x');
$weather->setLocationId('BRXX0201');
$weather->setForecast(2);

$response $weather->getService()->request();

$response->location_name;
$response->temperature//current temperature

foreach ($response->forecasts as $forecast)
{
        
$forecast->hi;
        
$forecast->low;
}

/* CONFIGS */
setPartnerId(); // required
setLicenseKey(); // required
setLocationId(); // required
setForecast(); // optional

/* ATTRIBUTES */
$response $weather->getService()->request(); // Get the response from the server
$response->location_name// Location name
$response->temperature// Current temperature
$response->forecasts// Forecast Days, only if setForecast() is set.

$forecast->hi;
$forecast->low;
$forecast->dayIcon;
$forecast->nightIcon;