Remote Procedure Calls with PEAR::XML-RPC - Client Receiving
(Page 6 of 12 )
A value object is extracted from the response by the response object's value method. For scalar values, the value's type can then be extracted with scalartype and the value extracted with scalarval.
<?php $value = $result->value(); $number = $value->scalarval(); ?> |
Again, serialize can be used to view the message and response XML.
<?php echo "<p><b>Return Value:</b> $number </p>"; echo "<p><b>Received XML Message:</b>"; echo "<pre>" . htmlentities($result->serialize()) . "</pre></p>";
echo "<p>$first $last's name is $number letters long.</p>"; ?> |
The arraymem and structmem methods are used to extract a specified array or structure member. For example:
<?php $value = $result->arraymem($n); $value = $result->structmem($memberName); ?> |
The arraymem method returns element $n of $result as a value object. The structmem method returns $memberName of $result as a value object.
Next: Server Rewritten Example >>
More Miscellaneous Articles
More By bluephoenix