pcs_dmw Posted March 30, 2012 Share Posted March 30, 2012 Firstly hello - I've not posted on here before! I'm after a bit of advice if possible - I recently upgraded to a new server with RHEL6 and PHP 5.3.10 from a previous server with RHEL4 and PHP 5.2.17. I have some postcode lookup software running that functioned perfectly on our old server, but seems to cause a server 500 error with the updated version of PHP. I cannot downgrade to PHP 5.2.17 so I need to fix the issue or workaround it. A snippet of the code is as follows: $data = simplexml_load_string(file_get_contents($url)); foreach ($data->Rows->children() as $row) { I have narrowed down the cause of the failure to "children()" - it seems that anything with the curly brackets causes the code to die? As you may guess I'm not a guru with PHP - I just know enough to get by. What do I need to do to get this working? Many thanks in advance. Danny Quote Link to comment https://forums.phpfreaks.com/topic/259994-postcodeanywhere-lookup-on-php-5310/ Share on other sites More sharing options...
trq Posted March 30, 2012 Share Posted March 30, 2012 Most likely your call to file_get_contents() has failed due to the fact that url wrappers are not enabled. Calling $data->Rows->children() would then fail because Rows is not an object. Of course you failed to mention what the errors you are receiving are so that is simply a guess. Quote Link to comment https://forums.phpfreaks.com/topic/259994-postcodeanywhere-lookup-on-php-5310/#findComment-1332627 Share on other sites More sharing options...
pcs_dmw Posted April 3, 2012 Author Share Posted April 3, 2012 Many Thanks for your help with this. The issue has now been resolved. Quote Link to comment https://forums.phpfreaks.com/topic/259994-postcodeanywhere-lookup-on-php-5310/#findComment-1333800 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.