Re: [PHP] Help translating PHP5 code to PHP4.
> The ease I had in running multiple versions of PHP on Windows would > suggest it should be pretty easy to do for non-windows. Funny and true. Thanks for the tips Richard, I've suggested that they upgrade their hosting package. Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help translating PHP5 code to PHP4.
On 7 March 2011 17:29, Marc Guay wrote: > Hi Richard, > > It's not a SOAP service, and I've actually decided to have ask the > client to upgrade their server software before continuing. But for > the sake of study: > >> Depending upon your requirement, you could use simplexml_load_string() to >> convert an XML string into a native PHP object rather than manually parsing >> the text of the XML string. > > I looked up simplexml_load_string() and the manual seems to say that > it's only available in PHP5. Can you clarify? > > Marc Ah. I see that you are trying to port TO V4 ... (Yes, simplexml is PHP5+ only). PHP4 is end of life and though I have my ZCE which was gained based upon PHP4, I've not really used it for the last many years (looking back it is probably 5 years or so). Depending upon their hosting, I would recommend one of the following options. 1 - Upgrade to PHP 5.3.5 2 - Dual install PHP 5.3.5 3 - Create a new vhost with PHP 5.3.5 I'm guessing upgrading straight away is a no-no. Running PHP4 and PHP5 SxS is very simple (I used to run PHP4 ISAPI, PHP5 CGI and PHP6-dev CGI - on the same Sambar Server - on Windows too!). The ease I had in running multiple versions of PHP on Windows would suggest it should be pretty easy to do for non-windows. Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help translating PHP5 code to PHP4.
On 3/7/2011 8:16 AM, Marc Guay wrote: > Hi folks, > > I've stumbled into a project involving a server running PHP4 without > cURL. The script fetches data from an XML webservice and deals with > it. Is http://ca2.php.net/xml_parser_create the place to start? Any > tips (besides updating PHP)? > > Here's an example of the PHP5 code: > > $url = "http://www.domain.com/webservice.php?var=foo";; > $ch = curl_init($url); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); > $val = curl_exec($ch); > curl_close($ch); > libxml_use_internal_errors(true); > $xml = simplexml_load_string($val); > $errors = libxml_get_errors(); > > if (!($errors)){ > $myvariable = $xml->attributes()->value; > } > else{ > // deal with errors > } > Here is an example that is in the PHP manual http://us.php.net/manual/en/function.xml-parser-create.php#38739 The only modification that you will probably have to make is to set the following in your php.ini file. allow_url_include = On and/or allow_url_fopen = On This would allow fopen to open the external URL and grab the data returned. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help translating PHP5 code to PHP4.
Hi Richard, It's not a SOAP service, and I've actually decided to have ask the client to upgrade their server software before continuing. But for the sake of study: > Depending upon your requirement, you could use simplexml_load_string() to > convert an XML string into a native PHP object rather than manually parsing > the text of the XML string. I looked up simplexml_load_string() and the manual seems to say that it's only available in PHP5. Can you clarify? Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help translating PHP5 code to PHP4.
On 7 March 2011 16:16, Marc Guay wrote: > Hi folks, > > I've stumbled into a project involving a server running PHP4 without > cURL. The script fetches data from an XML webservice and deals with > it. Is http://ca2.php.net/xml_parser_create the place to start? Any > tips (besides updating PHP)? > > Here's an example of the PHP5 code: > > $url = "http://www.domain.com/webservice.php?var=foo";; > $ch = curl_init($url); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); > $val = curl_exec($ch); > curl_close($ch); > libxml_use_internal_errors(true); > $xml = simplexml_load_string($val); > $errors = libxml_get_errors(); > > if (!($errors)){ > $myvariable = $xml->attributes()->value; > } > else{ > // deal with errors > } > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Is it a SOAP service? If so, PHP supports SOAP natively using SOAPClient (and you can create your own SOAPServers too). Depending upon your requirement, you could use simplexml_load_string() to convert an XML string into a native PHP object rather than manually parsing the text of the XML string. Can you give any more details? Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help translating PHP5 code to PHP4.
Just take another web host. 2011/3/7 Marc Guay > Hi folks, > > I've stumbled into a project involving a server running PHP4 without > cURL. The script fetches data from an XML webservice and deals with > it. Is http://ca2.php.net/xml_parser_create the place to start? Any > tips (besides updating PHP)? > > Here's an example of the PHP5 code: > > $url = "http://www.domain.com/webservice.php?var=foo";; > $ch = curl_init($url); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); > $val = curl_exec($ch); > curl_close($ch); > libxml_use_internal_errors(true); > $xml = simplexml_load_string($val); > $errors = libxml_get_errors(); > > if (!($errors)){ >$myvariable = $xml->attributes()->value; > } > else{ >// deal with errors > } > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- sexyprout