Discussion:
[phpxmlrpc] Producing a struct with XML_RPC_Value?
Jonas Petersson
2010-09-09 20:48:54 UTC
Permalink
Dear phpxmlrpc gurus,

May I ask for you advice? I'm trying to produce a request like this one:

<?xml version="1.0"?>
<methodCall>
<methodName>help</methodName>
<params>
<param><value><struct>
<member><name>HELP</name><value><string></string></value></member>
<member><name>rpc_key</name><value><string>MYSECRETKEY</string></value></member>

</struct></value>
</param>
</params>
</methodCall>


...from php (the above comes from a perl script). However, I can't
figure out how to massage my params variable to produce this. Here is
one of my recent tries...


$params = array(new XML_RPC_Value("HELP", "string"),
array(new XML_RPC_VALUE("rpc_key") =>
new XML_RPC_Value("MYSECRETKEY", "string")));
$msg = new XML_RPC_Message('help', $params);
$cli = new XML_RPC_Client('/xmlrpc','http://www.upcdatabase.com');
$cli->setDebug(1);
$resp = $cli->send($msg);

As you can guess, this fails miserably. Presumably I'm doing something
very stupid, being a novice on this.

Many thanks in advance / Jonas

PS. Yes I'm using the upc database and they just adjusted their API to
require this rpc_key - previously it worked fine being open to the world.
Gaetano Giunta
2010-09-09 22:54:54 UTC
Permalink
Post by Jonas Petersson
Dear phpxmlrpc gurus,
<?xml version="1.0"?>
<methodCall>
<methodName>help</methodName>
<params>
<param><value><struct>
<member><name>HELP</name><value><string></string></value></member>
<member><name>rpc_key</name><value><string>MYSECRETKEY</string></value></member>
</struct></value>
</param>
</params>
</methodCall>
...from php (the above comes from a perl script). However, I can't
figure out how to massage my params variable to produce this. Here is
one of my recent tries...
$params = array(new XML_RPC_Value("HELP", "string"),
array(new XML_RPC_VALUE("rpc_key") =>
new XML_RPC_Value("MYSECRETKEY", "string")));
try

$params = array( new XML_RPC_Value(array(new XML_RPC_Value("HELP", "string"),
array(new XML_RPC_VALUE("rpc_key") =>
new XML_RPC_Value("MYSECRETKEY", "string"))), 'struct' ) );


or something to that effect: an array containing 1 single param, of type struct
Post by Jonas Petersson
$msg = new XML_RPC_Message('help', $params);
$cli = new XML_RPC_Client('/xmlrpc','http://www.upcdatabase.com');
$cli->setDebug(1);
$resp = $cli->send($msg);
As you can guess, this fails miserably. Presumably I'm doing something
very stupid, being a novice on this.
Many thanks in advance / Jonas
PS. Yes I'm using the upc database and they just adjusted their API to
require this rpc_key - previously it worked fine being open to the world.
_______________________________________________
phpxmlrpc mailing list
phpxmlrpc at lists.usefulinc.com
http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
Continue reading on narkive:
Search results for '[phpxmlrpc] Producing a struct with XML_RPC_Value?' (Questions and Answers)
5
replies
can i get question answer of asp.net ?
started 2006-10-11 00:02:47 UTC
software
Loading...