got allow_url_fopen, still don't travel :) [message #174030] |
Thu, 19 May 2011 22:09 |
Evolution
Messages: 14 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
So I got the allow_url_fopen turned on for my webshare but when I
combine the temperature from NOAA's xml file, I still get zero
output. It's as if the strftime and simplexml_load_file are
incompatible.
This gets no output:
<?
session_register();
session_start();
Today is
print (strftime("%A, %B %e, %Y"));
echo " in Santa Barbara where the temperature is "
$url = 'http://www.nws.noaa.gov/data/current_obs/KSBA.xml';
$xml = simplexml_load_file($url);
echo $xml->temp_f,' F<br />';
?>
but when I comment out line 4-6, I at least get the temperature.
<?
session_register();
session_start();
// Today is
// print (strftime("%A, %B %e, %Y"));
// echo " in Santa Barbara where the temperature is "
$url = 'http://www.nws.noaa.gov/data/current_obs/KSBA.xml';
$xml = simplexml_load_file($url);
echo $xml->temp_f,' F<br />';
?>
My test web page (the code directly above) is at:
http://www.geol.ucsb.edu/library/php/w3.php
Thanks for any help.
|
|
|
Re: got allow_url_fopen, still don't travel :) [message #174036 is a reply to message #174030] |
Fri, 20 May 2011 01:45 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 5/19/2011 6:09 PM, Evolution wrote:
> So I got the allow_url_fopen turned on for my webshare but when I
> combine the temperature from NOAA's xml file, I still get zero
> output. It's as if the strftime and simplexml_load_file are
> incompatible.
>
> This gets no output:
>
> <?
> session_register();
> session_start();
> Today is
> print (strftime("%A, %B %e, %Y"));
> echo " in Santa Barbara where the temperature is "
> $url = 'http://www.nws.noaa.gov/data/current_obs/KSBA.xml';
> $xml = simplexml_load_file($url);
> echo $xml->temp_f,' F<br />';
> ?>
>
> but when I comment out line 4-6, I at least get the temperature.
>
> <?
> session_register();
> session_start();
> // Today is
> // print (strftime("%A, %B %e, %Y"));
> // echo " in Santa Barbara where the temperature is "
> $url = 'http://www.nws.noaa.gov/data/current_obs/KSBA.xml';
> $xml = simplexml_load_file($url);
> echo $xml->temp_f,' F<br />';
> ?>
>
> My test web page (the code directly above) is at:
>
> http://www.geol.ucsb.edu/library/php/w3.php
>
> Thanks for any help.
>
>
>
>
>
Turn on your error reporting and fix your syntax error.
On your development system, ensure your php.ini file has:
error_reporting = E_ALL // or E_ALL | E_STRICT
display_errors = on
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: got allow_url_fopen, still don't travel :) [message #174042 is a reply to message #174030] |
Fri, 20 May 2011 06:09 |
Evolution
Messages: 14 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
On May 19, 3:09 pm, Evolution <cryptoz...@gmail.com> wrote:
> So I got the allow_url_fopen turned on for my webshare but when I
> combine the temperature from NOAA's xml file, I still get zero
> output. It's as if the strftime and simplexml_load_file are
> incompatible.
>
> This gets no output:
>
> <?
> session_register();
> session_start();
> Today is
> print (strftime("%A, %B %e, %Y"));
> echo " in Santa Barbara where the temperature is "
> $url = 'http://www.nws.noaa.gov/data/current_obs/KSBA.xml';
> $xml = simplexml_load_file($url);
> echo $xml->temp_f,' F<br />';
> ?>
>
> but when I comment out line 4-6, I at least get the temperature.
>
> <?
> session_register();
> session_start();
> // Today is
> // print (strftime("%A, %B %e, %Y"));
> // echo " in Santa Barbara where the temperature is "
> $url = 'http://www.nws.noaa.gov/data/current_obs/KSBA.xml';
> $xml = simplexml_load_file($url);
> echo $xml->temp_f,' F<br />';
> ?>
>
> My test web page (the code directly above) is at:
>
> http://www.geol.ucsb.edu/library/php/w3.php
>
> Thanks for any help.
Okay, that was lame. I figured it out. Before I had the text in the
HTML where it didn't need a print statement and, once it was inside
the PHP, I found some way to ignore it. :)
|
|
|
Re: got allow_url_fopen, still don't travel :) [message #174043 is a reply to message #174042] |
Fri, 20 May 2011 07:16 |
Michael Fesser
Messages: 215 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
.oO(Evolution)
> Okay, that was lame. I figured it out. Before I had the text in the
> HTML where it didn't need a print statement and, once it was inside
> the PHP, I found some way to ignore it. :)
You should also avoid short open tags (<?) or your code will fail again
on the next server, which doesn't have this setting enabled.
And what is session_register() doing there? This function is useless
since years and officially deprecated as of PHP 5.3.
Micha
|
|
|