Thread: Using PHPWeather question
Brought to you by:
iridium
From: Jenni <je...@da...> - 2004-02-07 17:55:56
|
I have installed and configured PHPWeather, but am having problems actually getting it to work on my blog. I am fairly new to PHP and MySQL, although I've been able to teach myself enough to figure most things out. But for some reason I cannot figure out how to call the weather information into my blog. I tried using: <?php include('phpweather.inc'); include('locale_en.inc'); $metar = get_metar('KOMA'); $data = process_metar($metar); $temp_c = $data['temp_c']; $temp_f = $data['temp_f']; echo "<p>The temperature is $temp_c degrees Celsius ($temp_f degrees Fahrenheit).</p>"; ?> I cannot see where I have a filed named "phpweather.inc" or "locale_en.inc" Can anyone clue me in as to what I did wrong? The documentation isn't very user friendly for us newbies. ;-) Thanks, Jenni -- "Nowadays every girl with a henna tattoo and a spice rack thinks she's a sister to the dark ones." |
From: Daisyhead <je...@da...> - 2004-02-08 18:23:36
|
A couple of clarifications. I'm using v2.21 of PHPWeather and cannot find what code I need to place in my blog to pull the weather info in. This is my second request for h*lp. Can someone please respond? Thanks, Jenni ----- Original Message ----- From: "Jenni" <je...@da...> To: <php...@li...> Sent: Saturday, February 07, 2004 11:55 AM Subject: Using PHPWeather question > I have installed and configured PHPWeather, but am having problems actually > getting it to work on my blog. I am fairly new to PHP and MySQL, although > I've been able to teach myself enough to figure most things out. But for > some reason I cannot figure out how to call the weather information into my > blog. I tried using: > > <?php > include('phpweather.inc'); > include('locale_en.inc'); > $metar = get_metar('KOMA'); > $data = process_metar($metar); > $temp_c = $data['temp_c']; > $temp_f = $data['temp_f']; > echo "<p>The temperature is $temp_c degrees Celsius ($temp_f degrees > Fahrenheit).</p>"; > ?> > > I cannot see where I have a filed named "phpweather.inc" or "locale_en.inc" > Can anyone clue me in as to what I did wrong? The documentation isn't very > user friendly for us newbies. ;-) > > Thanks, > Jenni |
From: Max H. <ma...@fl...> - 2004-02-08 19:20:54
|
Jenni, almost there. <?php require('phpweather.php'); $weather = new phpweather(); $weather->set_icao("KOMA"); $foo = $weather->decode_metar(); $temp_c = $foo['temperature']['temp_c']; $temp_f = $foo['temperature']['temp_f']; echo "<p>The temperature is $temp_c degrees Celsius ($temp_f degrees Fahrenheit).</p>"; ?> If this script isn't in the same place as the phpweather install, you'll need to modify the first line accordingly. Incidentally, we're all busy people doing other things, so don't be suprised if a reply takes a day or two. Cheers, Max > -----Original Message----- > From: php...@li... > [mailto:php...@li...]On Behalf Of > Daisyhead > Sent: 08 February 2004 18:23 > To: php...@li... > Subject: Re: Using PHPWeather question > > > A couple of clarifications. I'm using v2.21 of PHPWeather and cannot find > what code I need to place in my blog to pull the weather info in. > > This is my second request for h*lp. Can someone please respond? > > Thanks, > Jenni > > > ----- Original Message ----- > From: "Jenni" <je...@da...> > To: <php...@li...> > Sent: Saturday, February 07, 2004 11:55 AM > Subject: Using PHPWeather question > > > > I have installed and configured PHPWeather, but am having problems > actually > > getting it to work on my blog. I am fairly new to PHP and > MySQL, although > > I've been able to teach myself enough to figure most things out. But for > > some reason I cannot figure out how to call the weather information into > my > > blog. I tried using: > > > > <?php > > include('phpweather.inc'); > > include('locale_en.inc'); > > $metar = get_metar('KOMA'); > > $data = process_metar($metar); > > $temp_c = $data['temp_c']; > > $temp_f = $data['temp_f']; > > echo "<p>The temperature is $temp_c degrees Celsius ($temp_f degrees > > Fahrenheit).</p>"; > > ?> > > > > I cannot see where I have a filed named "phpweather.inc" or > "locale_en.inc" > > Can anyone clue me in as to what I did wrong? The documentation > isn't very > > user friendly for us newbies. ;-) > > > > Thanks, > > Jenni > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > PHPWeather-devel mailing list > PHP...@li... > https://lists.sourceforge.net/lists/listinfo/phpweather-devel > |
From: Daisyhead <je...@da...> - 2004-02-08 20:05:46
|
> Incidentally, we're all busy people doing other things, so don't be > suprised if a reply takes a day or two. I totally understand Max. I apologize if I came off as being pushy and/or rude. I was just frustrated by not being able to get it running. I wish there was a forum or something so we could get a little more help. Although I suppose the product was written for people with more knowledge of PHP and SQL than myself. Thanks again! -Jenni |
From: Daisyhead <je...@da...> - 2004-02-08 20:56:19
|
Max, Could I ask one more question? I'm trying to add other tags and my current code looks like this: <?php require('/home/xxx/public_html/weather/phpweather.php'); $weather = new phpweather(); $weather->set_icao("KOMA"); $foo = $weather->decode_metar(); $temp_c = $foo['temperature']['temp_c']; $temp_f = $foo['temperature']['temp_f']; $miles_per_hour = $foo['wind']['miles_per_hour']; echo "Temp: $temp_f ° Fahrenheit<br>"; ?> echo "Wind: $miles_per_hour MPH"; ?> But I cannot get the wind speed to show up. Any idea what I'm doing wrong? I thought you could just plug in the other tags you want and Presto! Thanks, Jenni |
From: Max H. <ma...@fl...> - 2004-02-08 21:34:49
|
Hi Jenni, You've closed the PHP ?> twice... > echo "Temp: $temp_f ° Fahrenheit<br>"; > ?> > echo "Wind: $miles_per_hour MPH"; > ?> > get rid of the first one of those ?>'s Cheers, Max -- Actions are the seeds of Fate. Deeds grow into Destiny. *A.L. Linall, Jr. |
From: Martin G. <gim...@gi...> - 2004-02-08 23:12:53
|
"Jenni" <je...@da...> writes: > I have installed and configured PHPWeather, but am having problems > actually getting it to work on my blog. > > [...] > > I cannot see where I have a filed named "phpweather.inc" or > "locale_en.inc" The code you're trying to use was written for the obsolete 1.x series of PHP Weather. Unless you have a really old installation of PHP, or some other strange demands, then you should use the new 2.x series, specifically version 2.2.1: http://sf.net/project/showfiles.php?group_id=23245&package_id=69338&release_id=214708 > Can anyone clue me in as to what I did wrong? The documentation > isn't very user friendly for us newbies. ;-) The 2.x series have better (but still far from perfect) documentation, which you'll find in the tarball/zipfile. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather: Shows the current weather on your webpage and PHP Shell: A telnet-connection (almost :-) in a PHP page. |
From: Martin G. <gim...@gi...> - 2004-02-09 00:46:43
|
"Jenni" <je...@da...> writes: > I have installed and configured PHPWeather, but am having problems > actually getting it to work on my blog. > > [...] > > I cannot see where I have a filed named "phpweather.inc" or > "locale_en.inc" The code you're trying to use was written for the obsolete 1.x series of PHP Weather. Unless you have a really old installation of PHP, or some other strange demands, then you should use the new 2.x series, specifically version 2.2.1: http://sf.net/project/showfiles.php?group_id=23245&package_id=69338&release_id=214708 > Can anyone clue me in as to what I did wrong? The documentation > isn't very user friendly for us newbies. ;-) The 2.x series have better (but still far from perfect) documentation, which you'll find in the tarball/zipfile. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather: Shows the current weather on your webpage and PHP Shell: A telnet-connection (almost :-) in a PHP page. |