Discussion:
[phpxmlrpc] Please Help!!
Renzo J. Ezagui
2010-05-20 04:49:15 UTC
Permalink
I need to evaluate some variables which are send it from a mobile
application via XML-RPC.
I know that the application is sending me this XML:

-- this is an example --
<value><struct>
<member><name>product</name>
<value><i4>1</i4></value>
</member>
<member><name>license</name>
<value><string>56621365</string></value>
</member>
<member><name>pin</name>
<value><string>216B22DD</string></value>
</member>
<member><name>version</name>
<value><i4>3</i4></value>
</member>
</struct></value>

i need to have in PHP decoded vars that information
(product,license,pin,version)

i did this to know the XML:

<?php
include("../lib/xmlrpc.inc");
include("../lib/xmlrpcs.inc");
function info ( $params ){
$t=$params->getParam(0);
$tamano = $t->serialize();
$file = "data.txt";
$file_handle = fopen($file,"a");
fwrite($file_handle, "$tamano \n" );
fclose($file_handle);
}
$s=new xmlrpc_server(array("activate" =>array("function" => "info")));
?>

now a i want to store (product,license,pin,version) in vars like $prod
$lic $pin $vers but i cant decode it or extract them from the message or
from this string that i already printed to a file.

Please help, sorry for my crappy english
Gaetano Giunta
2010-05-23 13:12:47 UTC
Permalink
Post by Renzo J. Ezagui
I need to evaluate some variables which are send it from a mobile
application via XML-RPC.
-- this is an example --
<value><struct>
<member><name>product</name>
<value><i4>1</i4></value>
</member>
<member><name>license</name>
<value><string>56621365</string></value>
</member>
<member><name>pin</name>
<value><string>216B22DD</string></value>
</member>
<member><name>version</name>
<value><i4>3</i4></value>
</member>
</struct></value>
i need to have in PHP decoded vars that information
(product,license,pin,version)
<?php
include("../lib/xmlrpc.inc");
include("../lib/xmlrpcs.inc");
function info ( $params ){
$t=$params->getParam(0);
$tamano = $t->serialize();
$file = "data.txt";
$file_handle = fopen($file,"a");
fwrite($file_handle, "$tamano \n" );
fclose($file_handle);
}
$s=new xmlrpc_server(array("activate" =>array("function" => "info")));
?>
now a i want to store (product,license,pin,version) in vars like $prod
$lic $pin $vers but i cant decode it or extract them from the message or
from this string that i already printed to a file.
the easiest way to map a phpxmlrpcval object (what $tamano is in the example above) is to use the php_xmlrpc_decode function

var_export( php_xmlrpc_decode( $tamano ) );

bye
Gaetano
Post by Renzo J. Ezagui
Please help, sorry for my crappy english
_______________________________________________
phpxmlrpc mailing list
phpxmlrpc at lists.usefulinc.com
http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
Loading...