angelleye Posted August 30, 2007 Share Posted August 30, 2007 I developed a PayPal solution for my client but I have PHP 5.2 installed on my development server. I made the mistake of assuming my client's host would also have PHP5. Of course, they're using PHP 4.4 so now all of my DOM code that parses XML responses does not work. I always have trouble understanding php.net for some reason. I tend to do better with tutorials/guides people write out and show lots of nice sample code. I can't seem to find anything like that for PHP 4 XML DOM besides php.net. I just don't follow it for some reason. Anyway, here is a short snippet of code that does not work in PHP 4 because I'm using PHP5 DOM instead of PHP4 XML DOM. If I could get some information ( or sample code would be great ) now how to convert this so it will work with PHP4 XML DOM then I think I can handle converting the rest of my stuff. $xmlDOM = new DOMDocument(); $xmlDOM -> loadXML($SOAPResponse); $xPath = new DOMXPath($xmlDOM); $xPath -> registerNamespace("pp", "urn:ebay:api:PayPalAPI"); $xPath -> registerNamespace("ebay", "urn:ebay:apis:eBLBaseComponents"); $FaultCode = $xmlDOM -> getElementsByTagName("faultcode"); if($FaultCode -> length > 0) { $FaultCode = $FaultCode -> item(0) -> nodeValue; $FaultString = $xmlDOM -> getElementsByTagName("faultstring"); $FaultString = $FaultString -> item(0) -> nodeValue; ?> </p> <table width="500" border="0" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="129" align="right" valign="top"><strong>Fault Code:</strong></td> <td width="357" align="left" valign="top"><?php echo $FaultCode; ?> </td> </tr> <tr> <td align="right" valign="top"><strong>Fault Message:</strong></td> <td align="left" valign="top"><?php echo $FaultString; ?> </td> </tr> </table> <?php die(); } Any info would be greatly appreciated. Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/67367-need-to-convert-php-5-dom-code-to-php-4-xml-dom/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.