php-general Digest 23 Dec 2005 10:09:47 -0000 Issue 3866

Topics (messages 227815 through 227838):

Re: how to calculate with dates?
        227815 by: John Nichel
        227817 by: Ray Hauge

Re: unlink, symlink and caching
        227816 by: jgmtfia Mr
        227833 by: Curt Zirzow
        227837 by: jgmtfia Mr

Re: insert to DB
        227818 by: PHP Superman

Re: Connection: close Always?
        227819 by: Michael B Allen
        227821 by: Michael B Allen
        227834 by: Curt Zirzow

Sessions...
        227820 by: Dan Parry
        227829 by: Greg Donald
        227832 by: Chris Shiflett

Re: PHP is OK in IE but not in Netscape
        227822 by: Mike Rondeau

Free Hosting?
        227823 by: Dan Uyemura

PHP interference in frames
        227824 by: Ron Rudman
        227825 by: PHP Superman

Problems getting the nodeName with DomDocument
        227826 by: Kenneth Andresen

utf-8 in mysql but not outputting as utf-8 on web
        227827 by: jonathan
        227828 by: Kenneth Andresen
        227830 by: Kenneth Andresen
        227831 by: Ligaya Turmelle
        227835 by: Curt Zirzow
        227836 by: Denis Gerasimov

SimpleXML returning Object names with hyphens
        227838 by: Charlie Davis

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Marten Lehmann wrote:
Hello,

I'm used to work with Date::Calc in Perl. How can I calculate with dates in PHP, like adding an hour or a year to a date?

Regards
Marten


http://us3.php.net/mktime

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---


John Nichel wrote:

Marten Lehmann wrote:

Hello,

I'm used to work with Date::Calc in Perl. How can I calculate with dates in PHP, like adding an hour or a year to a date?

Regards
Marten


http://us3.php.net/mktime


You could also use the PEAR Date package. I have used it in a few projects to help with manipulating dates.

http://pear.php.net/package/Date

--- End Message ---
--- Begin Message ---
> > I just ran the test with php4 cli and it works correctly.
> > PHP 4.3.10-15 (cli) (built: May  9 2005 08:54:56)
> >
> > But with php5 cli and apache2 module it does not:
> > PHP 5.1.0b3 (cli) (built: Oct 18 2005 16:13:19)
> > PHP 5.1.0 apache module
>
> The versions I ran the tests  were on:
>   PHP 5.1.0RC5-dev (cli) (built: Nov 17 2005 10:02:23)
>   PHP 5.1.2-dev (cli) (built: Dec 19 2005 12:03:32)
>
> > Is this not a bug?
>
> If it still happens on your system with the latest snapshot it
> sounds like it.

I just downloaded + compiled 5.1.1 and it does have the same problem. 
What should be next step be?

--- End Message ---
--- Begin Message ---
On Thu, Dec 22, 2005 at 02:41:40PM -0700, jgmtfia Mr wrote:
> > > I just ran the test with php4 cli and it works correctly.
> > > PHP 4.3.10-15 (cli) (built: May  9 2005 08:54:56)
> > >
> > > But with php5 cli and apache2 module it does not:
> > > PHP 5.1.0b3 (cli) (built: Oct 18 2005 16:13:19)
> > > PHP 5.1.0 apache module
> >
> > The versions I ran the tests  were on:
> >   PHP 5.1.0RC5-dev (cli) (built: Nov 17 2005 10:02:23)
> >   PHP 5.1.2-dev (cli) (built: Dec 19 2005 12:03:32)
> >
> > > Is this not a bug?
> >
> > If it still happens on your system with the latest snapshot it
> > sounds like it.
> 
> I just downloaded + compiled 5.1.1 and it does have the same problem. 
> What should be next step be?

Probably reporting a bug report at http://bugs.php.net/, i did a
quick search but didn't see any open related to this but you might
want to search a little harder than I did.

Be sure to include the OS, filesystem type and the configure line
in the report, cause there seems to be something system dependent
causing it since the script you posted earlier worked fine on my
system.

Curt.
-- 
cat .signature: No such file or directory

--- End Message ---
--- Begin Message ---
> Be sure to include the OS, filesystem type and the configure line
> in the report, cause there seems to be something system dependent
> causing it since the script you posted earlier worked fine on my
> system.

Thanks for your help.  I appreciate it.

--- End Message ---
--- Begin Message ---
PHP might not be sending you an error, are warnings turned on in php.ini? if
not turn the on and see if you get any errors

On 12/18/05, David Hall <[EMAIL PROTECTED]> wrote:
>
>
> > <?
> >    if ($_POST["$submit"])
> >    {
> >       $Name = $_POST["Name"];
> >    $Rating = $_POST["Rating"];
> >
> >    $sql = "UPDATE leaderboard SET Name='$Name', Rating='$Rating' WHERE
> > ID=$id";
> >       //replace news with your table name above
> >       $result = mysql_query($sql);
> >       echo "Thank you! Information updated.";
> >  }
> > }
> > ?>
>
> You don't set id in this case.   Of course, from some of your other
> code, it looks like you're relying on register_globals to be on, so
> maybe it is and that's not why.
>
> David Hall
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now!

--- End Message ---
--- Begin Message ---
On Thu, 22 Dec 2005 09:42:08 +0100
Jochem Maas <[EMAIL PROTECTED]> wrote:

> Michael B Allen wrote:
> > Why does PHP always close the connection with Connection: close? I'm
> > using PHP 4.3.11 w/ Firefox 1.0.4. Requests are HTTP/1.1 and Connection:
> > keep-alive is requested.
> > 
> 
> a very small sum of money says that this is due to your
> webserver config and not php (check httpd.conf?).
> oh and I recommend upgrading to at least php4.4.x in order to
> be up2date with [security] fixes et al.

Yup.

#
# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
#
BrowserMatch "Mozilla/2" nokeepalive

WTF? Mozilla doesn't handle keep-alive!

Mike

--- End Message ---
--- Begin Message ---
On Thu, 22 Dec 2005 17:16:03 -0500
Michael B Allen <[EMAIL PROTECTED]> wrote:

> On Thu, 22 Dec 2005 09:42:08 +0100
> Jochem Maas <[EMAIL PROTECTED]> wrote:
> 
> > Michael B Allen wrote:
> > > Why does PHP always close the connection with Connection: close? I'm
> > > using PHP 4.3.11 w/ Firefox 1.0.4. Requests are HTTP/1.1 and Connection:
> > > keep-alive is requested.
> > > 
> > 
> > a very small sum of money says that this is due to your
> > webserver config and not php (check httpd.conf?).
> > oh and I recommend upgrading to at least php4.4.x in order to
> > be up2date with [security] fixes et al.
> 
> Yup.
> 
> #
> # The following directives modify normal HTTP response behavior to
> # handle known problems with browser implementations.
> #
> BrowserMatch "Mozilla/2" nokeepalive
> 
> WTF? Mozilla doesn't handle keep-alive!

Correction. Mozilla 2 aka Netscape 2.0 doesn't handle keep-alive
correctly. The directive responsible is actually:

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off

Mmm, why does the Fedora 4 apache package ship with keep-alive disabled?

Mike

--- End Message ---
--- Begin Message ---
On Thu, Dec 22, 2005 at 05:23:51PM -0500, Michael B Allen wrote:
>...
> 
> #
> # KeepAlive: Whether or not to allow persistent connections (more than
> # one request per connection). Set to "Off" to deactivate.
> #
> KeepAlive Off
> 
> Mmm, why does the Fedora 4 apache package ship with keep-alive disabled?

Yeah, i ran accross that on other linux distro packaging systems,
keepalive boosts performance by quite a bit.

Curt.
-- 
cat .signature: No such file or directory

--- End Message ---
--- Begin Message ---
Hi

 

I'm having some trouble with sessions and was wondering if anyone could give
me some insight

 

Background:

 

We have experienced some difficulties previously with sessions which were
fixed(ish) by using ini_set("session.save_handler", "files"); and manually
dropping a cookie with the propagated session ID in it

 

Without the implicit cookie (and subsequent ID checking) the session
wouldn't fix and changing page would make it overwrite its own data with
NULL (as if the session had been restarted)

 

Current:

 

I've decided to rock the boat and start using a custom handler (we need to
check who's online etc; the standard stuff) utilising our MySQL (v3.28) DB

 

Seeing that I'm not great with sessions (my bad, I haven't studied enough),
I used some code (pretty much verbatim) from the Zend site that sets up a
sessions class.
http://www.zend.com/zend/spotlight/code-gallery-wade8.php?article=code-galle
ry-wade8 << that's where the tutorial lives

 

Using the custom handler the sessions are failing to fixate again, even if I
drop a cookie with the propagated session ID and subsequently reuse it

 

I used my login script to attempt to track the problem and discovered that
the script that performs the login successfully writes to the database but
when it returns to the main page the session is present in the database but
the session value field is, once again, empty

 

Er, help. Please. I'm running out of hair to tear out :-)

 

TIA and apologies if this has already been answered or this is a halfwitted
question

 

Dan


--- End Message ---
--- Begin Message ---
On 12/22/05, Dan Parry <[EMAIL PROTECTED]> wrote:
> I've decided to rock the boat and start using a custom handler (we need to
> check who's online etc; the standard stuff) utilising our MySQL (v3.28) DB

I've been using this database driven PHP sessions setup for years:

http://dbsessions.destiney.com/



--
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

--- End Message ---
--- Begin Message ---
Greg Donald wrote:
I've been using this database driven PHP sessions setup for years:

http://dbsessions.destiney.com/

I offer a similar implementation:

http://phpsecurity.org/code/ch08-2

A few notes about yours (if you don't mind the critique):

1. It doesn't use a separate database connection, but it creates one anyway. I create a separate one, but only so that it can be dropped into any web application without adversely affecting it. In practice, I prefer to use a single connection.

2. Your sess_close() function does nothing, and this can make the session mechanism behave unexpectedly for a developer. For example, someone who actually depends upon session_write_close() for concurrent connections is severely impacted.

3. $GLOBALS[tb_sessions] is invalid syntax. It works, but only because PHP will check to see if you meant $GLOBALS['tb_sessions'] after it fails to find a constant named tb_sessions.

4. Your sess_read() function should return an empty string when no data is found, not FALSE. I originally made this same mistake.

5. Your sess_read() function has an SQL injection vulnerability. The argument passed comes directly from the user.

6. Your sess_write() function has the same SQL injection vulnerability.

7. In sess_write(), you also don't escape the session data, and this will give you problems, even with legitimate data that doesn't represent an SQL injection attack. For example, try setting a session variable that contains a quote somewhere:

    $_SESSION['publisher'] = "O'Reilly";

8. Your sess_write() function has the same SQL injection vulnerability.

9. Your sess_destroy() function has the same SQL injection vulnerability.

10. Your sess_gc() function returns the number of affected rows. Shouldn't it return TRUE on success? You may just be depending upon the evaluation of any non-zero integer to TRUE.

11. Your sess_gc() function ignores the session configuration and chooses its own expiry.

I hope this was helpful. I don't mean any disrespect - quite the opposite, since you're freely sharing your code. I applaud that. :-)

I think the SQL injection vulnerability is the biggest flaw. Most everything else doesn't matter too much, but that's a big one, and it exists in most of your session functions. A simple call to mysql_real_escape_string() can protect against this vulnerability (in these cases), and you'll see that I use this function on everything I use in my SQL queries, even when it seems ridiculous to do so:

    $access = time();
    $access = mysql_real_escape_string($access);

Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

--- End Message ---
--- Begin Message ---
I am still a newbie, but I am suprised that it effects browers at all, since it 
returns
pure HTML to the browser, right? Something so simple as echoing a "hello world" 
shouldn't cause trouble in so popular a browser as Netscape I would think...

Mike
PHP Newbie
  ----- Original Message ----- 
  From: David Grant 
  To: Nanu Kalmanovitz 
  Cc: [email protected] 
  Sent: Thursday, December 22, 2005 2:54 AM
  Subject: Re: [PHP] PHP is OK in IE but not in Netscape


  Nanu,

  Nanu Kalmanovitz wrote:
  > Ok, I will forget Netscape, what other popular browsers beside M$-IE
  > works with M$-Windows?

  I wouldn't "forget" Netscape, because people still use it.  Just make
  sure your code validates to W3C standards and so long as it isn't too
  cutting edge, must browsers should display it fine.

  To answer your question, Opera is probably the third most popular
  browser on Windows.

  Cheers,

  David
  -- 
  David Grant
  http://www.grant.org.uk/

  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
All - 
 
In my searches of a new host I have found this.. and in the spirit of
the holidays I will kindly share with everyone here.  
 
http://www.365yearsfree.com <http://www.365yearsfree.com/> 
 
I guess by finding the "hot host" everyday you get entered into a
drawing to win a free year of hosting, and they claim they will give out
a year a day for 2006... 
 
It looks like they have just launched (advertise page reads 870 ad
views, so it might have launched this week?) so I think we have the best
shot to win over the year!  Good luck to all.
 
PS: if you made it this far, I just found the "Hot Host".. It's Lunar
Pages.
 
-D
 

--- End Message ---
--- Begin Message ---
I've got this down to a bare bones test but am still stumped.  Can anyone 
explain why I get the behavior I do?

I have a frameset with 3 frames:
<html>
<head><title>testing</title></head>
<frameset rows='100,100,*'>
     <frame src='test1.php'></frame>
     <frame src='test2.php'></frame>
     <frame src='test3.php'></frame>
</frameset>
</html>

test1.php and test2.php are both simply:    <? sleep(5); ?>
test3.php is simply:   <? echo "This is some content"; ?>

When I invoke the main frameset, the output from test3.php takes 5 seconds 
to appear.
If I comment out either one of the sleep calls, the output from test3.php is 
immediate, which is what I expected in the first place.

I have session.auto_start = 0 in php.ini, so this has nothing to do with 
sessions.
I am running php 5.0.5.
I get the same results with both apache 2/mod_php and lighttpd/fastcgi, the 
latter with 40 php processes running.

I thought that each frame in a page was executed independently and 
asynchronously, yet frame4.php insists on "waiting" for one of the other 
frames to complete  (if the sleeps are 5 and 10, frame3 produces its output 
after 5 seconds).

What am I missing here?

--- End Message ---
--- Begin Message ---
I'm taking a wild guess here, maybe the browser insists on waiting for some
content but it's maximum content wait time is 5 seconds, the browser could
detect the connection to the server is still open and wait for 5 seconds or
another time

On 12/22/05, Ron Rudman <[EMAIL PROTECTED]> wrote:
>
> I've got this down to a bare bones test but am still stumped.  Can anyone
> explain why I get the behavior I do?
>
> I have a frameset with 3 frames:
> <html>
> <head><title>testing</title></head>
> <frameset rows='100,100,*'>
>     <frame src='test1.php'></frame>
>     <frame src='test2.php'></frame>
>     <frame src='test3.php'></frame>
> </frameset>
> </html>
>
> test1.php and test2.php are both simply:    <? sleep(5); ?>
> test3.php is simply:   <? echo "This is some content"; ?>
>
> When I invoke the main frameset, the output from test3.php takes 5 seconds
> to appear.
> If I comment out either one of the sleep calls, the output from test3.phpis
> immediate, which is what I expected in the first place.
>
> I have session.auto_start = 0 in php.ini, so this has nothing to do with
> sessions.
> I am running php 5.0.5.
> I get the same results with both apache 2/mod_php and lighttpd/fastcgi,
> the
> latter with 40 php processes running.
>
> I thought that each frame in a page was executed independently and
> asynchronously, yet frame4.php insists on "waiting" for one of the other
> frames to complete  (if the sleeps are 5 and 10, frame3 produces its
> output
> after 5 seconds).
>
> What am I missing here?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now!

--- End Message ---
--- Begin Message --- I am having problems with the following functions where my return simply is "#text Joe #text Smith #text unknown", it should have read
firstname Joe lastname Smith address unknown

What am I doing wrong?


<?php
$xmlstring = "<element><firstname>Joe</firstname><lastname>Smith</lastname><address>unknown</address></element>";

$domdoc = new DomDocument();
$domdoc->loadXML($xmlstring);
$domroot = $domdoc->documentElement;

function process_children($node)
{
   $children = $node->childNodes;
   foreach ($children as $elem) {
       if ($elem->nodeType == XML_TEXT_NODE) {
           if (strlen(trim($elem->nodeValue))) {
               $name = $elem->nodeName ;
$res = mb_convert_encoding(trim($elem->nodeValue), 'html', 'utf-8'); echo "$name $res \n"; }
       } else if ($elem->nodeType == XML_ELEMENT_NODE) {
           process_children($elem);
       }
   }
}

process_children($domroot);

?>

--- End Message ---
--- Begin Message --- I'm inserting some info into a mysql table which has the charset set to utf-8.

When I do a select via the command-line from mysql, it looks like this:
Clams and mussels with Dijon-crème fraîche-saffron sauce

assuming this is coming out in your email client ok, it should look good.

On a web page, I set the charset to utf-8 via:
header("Content-type: text/html; encoding: UTF-8");
as the top-line

I then do a select for this field and it outputs like this in the browser:
Clams and mussels with Dijon-crème fraîche-saffron sauce

I'm familiar with html encoding. As this is going to go to XML, I wanted to see if I could keep it in the native format. Am I doing something wrong on the web side why I won't display this correctly? Is there some Apache config I need to be aware of?

thanks,

jonathan

--- End Message ---
--- Begin Message ---
Hello,

why not simply convert the text to html

mb_convert_encoding($string, 'html', 'utf-8');


Best regards,
Kenneth


jonathan wrote:

I'm inserting some info into a mysql table which has the charset set to utf-8.

When I do a select via the command-line from mysql, it looks like this:
Clams and mussels with Dijon-crème fraîche-saffron sauce

assuming this is coming out in your email client ok, it should look good.

On a web page, I set the charset to utf-8 via:
header("Content-type: text/html; encoding: UTF-8");
as the top-line

I then do a select for this field and it outputs like this in the browser:
Clams and mussels with Dijon-crème fraîche-saffron sauce

I'm familiar with html encoding. As this is going to go to XML, I wanted to see if I could keep it in the native format. Am I doing something wrong on the web side why I won't display this correctly? Is there some Apache config I need to be aware of?

thanks,

jonathan

--- End Message ---
--- Begin Message ---
Hello Jonathan,

You probably don't have php5 compiled with mbstrings enabled, if you have complied php5 with iconv instead you can try

iconv('utf-8' , 'html', $string);

I don't know what to recommend if you don't have any of these complied into php5.

Best regards,
Kenneth

--

jonathan wrote:

thanks, never used this function. the weird thing is that it's throwing a fatal error saying mb_convert_encoding is undefined. I'm running 5.0.4.

hmmmm.....



Fatal error: Call to undefined function: mb_convert_encoding() in / home/arclocal/public_html/preview/Inc/menu.class.php on line 1563



On Dec 22, 2005, at 7:08 PM, Kenneth Andresen wrote:

Hello,

why not simply convert the text to html

mb_convert_encoding($string, 'html', 'utf-8');


Best regards,
Kenneth


jonathan wrote:

I'm inserting some info into a mysql table which has the charset set to utf-8.

When I do a select via the command-line from mysql, it looks like this:
Clams and mussels with Dijon-crème fraîche-saffron sauce

assuming this is coming out in your email client ok, it should look good.

On a web page, I set the charset to utf-8 via:
header("Content-type: text/html; encoding: UTF-8");
as the top-line

I then do a select for this field and it outputs like this in the browser:
Clams and mussels with Dijon-crème fraîche-saffron sauce

I'm familiar with html encoding. As this is going to go to XML, I wanted to see if I could keep it in the native format. Am I doing something wrong on the web side why I won't display this correctly? Is there some Apache config I need to be aware of?

thanks,

jonathan








--- End Message ---
--- Begin Message ---
Have you read this article - http://www.phparch.com/sample.php?mid=57 .


jonathan wrote:
I'm inserting some info into a mysql table which has the charset set to utf-8.

When I do a select via the command-line from mysql, it looks like this:
Clams and mussels with Dijon-crème fraîche-saffron sauce

assuming this is coming out in your email client ok, it should look  good.

On a web page, I set the charset to utf-8 via:
header("Content-type: text/html; encoding: UTF-8");
as the top-line

I then do a select for this field and it outputs like this in the  browser:
Clams and mussels with Dijon-crème fraîche-saffron sauce

I'm familiar with html encoding. As this is going to go to XML, I wanted to see if I could keep it in the native format. Am I doing something wrong on the web side why I won't display this correctly? Is there some Apache config I need to be aware of?

thanks,

jonathan

--

life is a game... so have fun.

--- End Message ---
--- Begin Message ---
On Thu, Dec 22, 2005 at 07:01:07PM -0800, jonathan wrote:
> I'm inserting some info into a mysql table which has the charset set  
> to utf-8.
> 
> When I do a select via the command-line from mysql, it looks like this:
> Clams and mussels with Dijon-cr�me fra�che-saffron sauce
> 
> assuming this is coming out in your email client ok, it should look  
> good.
> 
> On a web page, I set the charset to utf-8 via:
> header("Content-type: text/html; encoding: UTF-8");
> as the top-line

you want:

  Content-Type: text/html; charset=UTF-8


Also, take a look at the php.ini setting: 

  http://php.net/manual/en/ini.core.php#ini.default-charset


I would set that to UTF-8 and not worry about the header calls;
besides all pages should have some sort charset encoding set.

Curt.
-- 
cat .signature: No such file or directory

--- End Message ---
--- Begin Message ---
Hello,

Also the first query that is executed to MySQL server has to be:

SET CHARACTER SET utf8

This will set the character set for current connection to UTF-8 (default is
latin-1).

HTH

Have a great day,

Denis S Gerasimov 
Web Developer
Team Force LLC

Web:   www.team-force.org
RU & Int'l:   +7 8362-468693
email:    [EMAIL PROTECTED]

> -----Original Message-----
> From: Curt Zirzow [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 23, 2005 9:02 AM
> To: [email protected]
> Subject: Re: [PHP] utf-8 in mysql but not outputting as utf-8 on web
> 
> >
> > On a web page, I set the charset to utf-8 via:
> > header("Content-type: text/html; encoding: UTF-8");
> > as the top-line
> 
> you want:
> 
>   Content-Type: text/html; charset=UTF-8
> 
> 
> Also, take a look at the php.ini setting:
> 
>   http://php.net/manual/en/ini.core.php#ini.default-charset
> 
> 
> I would set that to UTF-8 and not worry about the header calls;
> besides all pages should have some sort charset encoding set.
> 
> Curt.
> --
> cat .signature: No such file or directory
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Hey all, I've run into a snag trying to use some XML output from NOAA.

The problem is that some of the fields it sends to me have a hyphen in the name. Simple XML then creates objects with hyphens in their name.

So here's the object I am having issues with:

object(SimpleXMLElement)#7 (2) {
  wind-speed => object(SimpleXMLElement)#9 (2) {
    name => string(10) Wind Speed
    value => array(37) {
      0 => string(1) 4
      1 => string(1) 4
      2 => string(1) 6
      3 => string(1) 4
      4 => string(1) 4
      5 => string(1) 4
      6 => string(1) 2
      7 => string(1) 0
      8 => string(1) 2
      9 => string(1) 8
      10 => string(1) 8
      11 => string(1) 8
      12 => string(1) 8
      13 => string(1) 8
      14 => string(1) 8
      15 => string(1) 8
      16 => string(1) 8
      17 => string(1) 6
      18 => string(1) 4
      19 => string(1) 6
      20 => string(1) 6
      21 => string(1) 8
      22 => string(2) 14
      23 => string(2) 12
      24 => string(2) 12
      25 => string(1) 8
      26 => string(1) 8
      27 => string(2) 10
      28 => string(2) 10
      29 => string(1) 8
      30 => string(2) 10
      31 => string(2) 10
      32 => string(2) 10
      33 => string(1) 8
      34 => string(1) 6
      35 => string(1) 8
      36 => string(2) 10
    }
  }
  direction => object(SimpleXMLElement)#10 (2) {
    name => string(14) Wind Direction
    value => array(37) {
      0 => string(3) 240
      1 => string(3) 230
      2 => string(3) 220
      3 => string(3) 216
      4 => string(3) 210
      5 => string(3) 220
      6 => string(3) 230
      7 => string(3) 230
      8 => string(3) 218
      9 => string(3) 202
      10 => string(3) 160
      11 => string(3) 164
      12 => string(3) 168
      13 => string(3) 180
      14 => string(3) 190
      15 => string(3) 180
      16 => string(3) 170
      17 => string(3) 100
      18 => string(2) 30
      19 => string(3) 340
      20 => string(3) 288
      21 => string(3) 282
      22 => string(3) 330
      23 => string(3) 310
      24 => string(3) 314
      25 => string(3) 280
      26 => string(3) 286
      27 => string(3) 294
      28 => string(3) 296
      29 => string(3) 298
      30 => string(3) 306
      31 => string(3) 316
      32 => string(3) 316
      33 => string(3) 328
      34 => string(3) 338
      35 => string(3) 350
      36 => string(3) 350
    }
  }
}

And here's my code issues:

$xmlobj->data->parameters->direction access works fine.
$xmlobj->data->parameters->direction->value works fine. Gives me the array.

$xmlobj->data->parameters->wind-speed returns an int value of 0. $xmlobj->data->parameters->wind-speed->value gives me an error:

Parse error: parse error, unexpected T_OBJECT_OPERATOR in noaa.php on line 59

So, what am I doing wrong? The only thing I can think of is the - in the wind-speed object name.

Any help would be appreciated!

-Charlie

--- End Message ---

Reply via email to