PHP Classes

How to use this class?

Recommend this page to a friend!

      PHP Weather Wunderground  >  All threads  >  How to use this class?  >  (Un) Subscribe thread alerts  
Subject:How to use this class?
Summary:Usage
Messages:5
Author:Marc
Date:2013-03-19 13:09:29
Update:2013-05-02 18:09:48
 

  1. How to use this class?   Reply   Report abuse  
Picture of Marc Marc - 2013-03-19 13:09:29
Hi,

Thanks for the API. But how do I use it? can you please brief me with a code snippet?

  2. Re: How to use this class?   Reply   Report abuse  
Picture of kz kz - 2013-03-25 11:24:20 - In reply to message 1 from Marc
First, You must get api key from wunderground.com and paste to :
/**
* Api key from wunderground.com
*
* @var string
*/
private $apiKey = 'Api key';

if You finish this step, You can paste this on Your site:

$w = new weather();
$w->setLocation('NY', 'New York');
$w->setLang(EN);
echo $w->getLocation();
echo '<br/>';
echo $w->getWeatherIcon(true);
echo '<br/>';
echo $w->getTemperature();
echo ' C';
echo '<br/>';
echo $w->getSateliteImage(true);

  3. Re: How to use this class?   Reply   Report abuse  
Picture of Marc Marc - 2013-03-25 13:20:00 - In reply to message 2 from kz
Thanks siarka.

  4. Re: How to use this class?   Reply   Report abuse  
Picture of Eve Eve - 2013-03-25 18:49:32 - In reply to message 2 from kz
Hi,
I tried using the code and I got this error - Warning: file_get_contents(http://api.wunderground.com/api/This is my keycode place/animatedsatellite/q/GR/Greece.gif?key=sat_ir4&basemap=1&timelabel=1&timelabel.y=10&num=5&delay=50&radius=200) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in /home/astro/public_html/NewSite/weather.php on line 84. I took out my apikey code so it would not be viewed in this message. Do I need to set the file to have certain permissions? I would like to display the weather of a few places in Europe. I did get the same error with the New York entry that was placed in your code. How do I get the codes for Greece, France, Italy....?

Thanks - emp

  5. Re: How to use this class?   Reply   Report abuse  
Picture of Luca Nonato Luca Nonato - 2013-05-02 18:09:48 - In reply to message 2 from kz
Looks like your code only includes functions to retrieve current weather data, not forecast for the next days...