FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » getting only the temperature & general weather condition
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: getting only the temperature & general weather condition [message #173845 is a reply to message #173844] Mon, 09 May 2011 01:53 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 5/8/2011 7:29 PM, Evolution wrote:
> On May 8, 5:11 am, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>> On 5/8/2011 3:07 AM, Evolution wrote:
>>
>>
>>
>>
>>
>>> On May 7, 4:23 am, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>>>> 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.
>>
>>> According to phpinfo(), allow_url_fopen is off. Although I maintain
>>> websites in my department as a network admin, I do not manage this
>>> particular site because, due to lack of staff, the Department gave the
>>> responsibility of it to the college several years back. Is there some
>>> security risk that would make them keep it off?
>>
>> It all depends on the security policies of your college and how the
>> server is being used.
>>
>>> Also, as you can imagine, I have no shell access to this system
>>> (except indirectly by mounting the directory tree via smb) and,
>>> according to phpinfo(), the php.ini file is located in the /etc/php/
>>> apache2-php5/ directory. Thus, I am unable to even view the php.ini
>>> file.
>>
>> phpinfo() can tell you pretty much everything you need to know.
>>
>>> I still cannot fathom though why a remote client (yours) would be able
>>> to view the results but not a local client (mine). Why would the
>>> server say no to me but not to you which, inherently, is less secure?
>>> It's not that I doubt you -- I'm just trying to understand what's
>>> happening here.
>>
>> Because I'm running the code from my own server, not yours. And I have
>> allow_url_fopen() enabled.
>
> I guess I should have realized that. I just thought you were clicking
> on the URL I posted. :) Thanks a bunch for your help. Any idea as to
> why they would have "allow_url_fopen()" off?
>
>
No, I can't see the code if it's on your server, and I have no control
over your environment. So it really does no good for me to try to test
the code on your server; besides, I'll only get the same result you do.

As for why - you'll have to ask the people running your server.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: evaluating a null value in an array
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 04:16:41 GMT 2024

Total time taken to generate the page: 0.06178 seconds