[phpxmlrpc] Read the XML File

Gaetano Giunta giunta.gaetano at sea-aeroportimilano.it
Thu Sep 14 12:01:11 UTC 2006

I am not really sure I undertand what you are asking...

If what you need is to save the responses received from the server as xml, =
you have two options:

1- use the serialize() method on the response object.

$resp =3D $client->send($msg);
if (!$resp->faultCode())
  $data_to_be_saved =3D $resp->serialize();

Note that this will not be 100% accurate, since the xml generated by the re=
sponse object can be different from the xml received, especially if there i=
s some character set conversion involved, or such (eg. if you receive an em=
pty string tag as <string/>, serialize() will output <string></string>), or=
 if the server sent back as response something invalid (in which case the x=
ml generated client side using serialize() wil correspond to the error resp=
onse generated internally by the lib)

2 - set the client object to return the raw xml received instead of the dec=
oded objects:

$client =3D new xmlrpc_client($whatever);
$client->return_type =3D 'xml'
$resp =3D $client->send($msg);
if (!$resp->faultCode())
  $data_to_be_saved =3D $resp->value();

Note that using this method the xml response response will not be parsed at=
 all by the library, only the http commuincation will be checked. This mean=
s that xmlrpc responses sent by the server that would have generated an err=
or response on the client (eg. malformed xml, responses that have faultcode=
/faultmsg set, etc...) now.

Hope this helps

  -----Original Message-----
  From: phpxmlrpc-bounces at lists.usefulinc.com [mailto:phpxmlrpc-bounces at lis=
ts.usefulinc.com]On Behalf Of kutty S.B.
  Sent: Thursday, September 14, 2006 11:49 AM
  To: phpxmlrpc at lists.usefulinc.com
  Subject: [phpxmlrpc] Read the XML File

  Hi all,

           I connect to Server and got the response from server.

  how i write the result into the xml files.

  It is Possible??

  Thanks in advance

  Find out what India is talking about on - Yahoo! Answers India =

  Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Ge=
t it NOW
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.usefulinc.com/pipermail/phpxmlrpc/attachments/20060914/d5=

More information about the phpxmlrpc mailing list