Re: Help translating PHP5 code to PHP4.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7 March 2011 16:16, Marc Guay <marc.guay@xxxxxxxxx> 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




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux