Re: [PHP] simplexml_load_string();
On Wed, July 18, 2007 8:41 am, Ross wrote: $data = simplexml_load_string(file_get_contents($url)); Is there a php4 version of this or does this only work in 5? How can I get around it? If you absolutely have to support PHP 4, be prepared for a rather long and tedious testing period where various funky things in different XML incarnations will break whichever XML package reader you choose. At least, that was my experience in all PHP XML solutions before PHP 5. There are 3 to choose from in PHP 4, I think, plus at least one popular one that's not built-in, but is just more PHP code. As Larry points out, dealing with XML is a VERY good reason to go with PHP 5 and abandon PHP 4. While nobody can guarantee the next 6 months or year outlook of PHP 4, I would expect a lot of webhosts are going to phase it out now that an official EOL has been announced. http://www.php.net/index.php#2007-07-13-1 -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simplexml_load_string();
$data = simplexml_load_string(file_get_contents($url)); Is there a php4 version of this or does this only work in 5? How can I get around it? R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] simplexml_load_string();
Try to do a search in PEAR.PHP.NET I remember I've seen something like this for php4, but not sure where. Lance -Original Message- From: Ross [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 18, 2007 8:41 AM To: php-general@lists.php.net Subject: [PHP] simplexml_load_string(); $data = simplexml_load_string(file_get_contents($url)); Is there a php4 version of this or does this only work in 5? How can I get around it? R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simplexml_load_string();
On Wednesday 18 July 2007, Ross wrote: $data = simplexml_load_string(file_get_contents($url)); Is there a php4 version of this or does this only work in 5? How can I get around it? There might be a user-space generic XML parser available somewhere, but nothing that will map directly to SimpleXML. SimpleXML uses language features that don't exist in PHP 4. The best answer is to use PHP 5 and let PHP 4 die a respectable death, as most of the world seems to have decided to do[1]. [1] http://gophp5.org/ -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simplexml_load_string always FALSE
I have a call $oXML = simplexml_load_string($xmlString); I then check it, with if(!$oXML) throw new XMLException(); For some reason, it's always evaluating to FALSE. Even though there are no errors and the rest of the xml parsing works fine. If I change it to if($oXML === FALSE) throw new XMLException(); then it works fine. Is it evaluating a valid xml object as 0? I wonder if anyone can enlighten me. Thanks, Scott Klarenbach -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simplexml_load_string always FALSE
On Thu, November 10, 2005 12:26 pm, Scott Klarenbach wrote: I have a call $oXML = simplexml_load_string($xmlString); I then check it, with if(!$oXML) throw new XMLException(); For some reason, it's always evaluating to FALSE. Even though there are no errors and the rest of the xml parsing works fine. If I change it to if($oXML === FALSE) throw new XMLException(); then it works fine. Is it evaluating a valid xml object as 0? Probably. The type-casting rules for PHP Objects to integer (and later boolean, when those were introduced) have changed in minor ways with every major release. The exact details of the OO-int conversion always seemed muddy to me, personally. I wonder if anyone can enlighten me. I think your code is way more better with the strict test you already discovered as a work-around. You are explicitly checking for FALSE, which is an unusual value for an Object to take on. You may also want to look at xmlerror or whatever it is, which is where there is PROBABLY and error message just waiting for you to ask. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php