Re: getting only the temperature & general weather condition [message #173824 is a reply to message #173822] |
Sat, 07 May 2011 11:23 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 5/7/2011 6:21 AM, Evolution wrote:
> On May 6, 6:23 pm, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>> On 5/6/2011 6:22 PM, Evolution wrote:
>>
>>
>>
>>
>>
>>> On phpbuilder.com, I found the following:
>>
>>> http://www.phpbuilder.com/board/showthread.php?t=10283087
>>
>>> which discusses how to obtain the current weather for a feed closest
>>> to you.
>>
>>> I modified the code to my site but didn't get the same results as
>>> shown by Kudose (a poster at the bottom of that same page).
>>
>>> My code is:
>>> <?
>>> session_register();
>>> session_start();
>>> $url = 'http://www.nws.noaa.gov/data/current_obs/KSBA.xml';
>>> $xml = simplexml_load_file($url);
>>
>>> echo '<b>Santa Barbara weather:</b><br />';
>>> echo $xml->weather, '<br />';
>>> echo $xml->temperature_string, '<br />';
>>> echo $xml->relative_humidity, '% humidity<br />';
>>> ?>
>>
>>> and the impaired results are on a test page at:
>>
>>> http://www.geol.ucsb.edu/library/php/weather.php
>>
>>> Can anybody point me in the right direction? I'm essentially a
>>> newbie.
>>> Thanks!
>>
>> The code works for me.
>>
>
> Wow! What could make this possible if I am using PHP5 and my browser
> fails but yours doesn't?
There are several possibilities. For instance, do you have a firewall
blocking access? Is allow_url_fopen() disabled? Or any of several things.
You need to do some debugging. First thing is to ensure they php.ini
file on your development system has:
display_errors=on
error_reporting=E_ALL // or E_ALL | E_STRICT
And see what kind of error messages you are getting.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|