Here is how to take apart an array. Let's say that
the top-level return is a structure which contains
an array named 'thing_array' as a member, and that
the array contains scalars.

$Val         = $result->value();
$ArrayMember = $Val->structmem('thing_array');

$ArrayCount  = $ArrayMember->arraysize();
for ($i = 0; $i < $ArrayCount; $i++)
  $ArrayVal = $ArrayMember->arraymem($i);
  $ArrayItem = $ArrayVal->scalarval();

  print("thing_array[$i] = $ArrayItem\n");

If you wanted to get really tricky, you could
deal with arrays of structures, arrays of
arrays, and so forth.


Hi Jeff

thanks for info, i am making progress.

I think the structmem variety.

first script

does call and simply uses print_r(get_object_vars($result)); to display

second script


  $Val       = $result->value();
  $domain = $Val->structmem("domain");
  $error = $Val->structmem("error");
  $found = $Val->structmem("found");

and again print_r(get_object_vars($error) etc. with a couple of added
markers to break up text.

now all i need to do is decode the 3 objects so i can grab the items like
'address' etc.
i guess these are nested Array's, any pointers


----- Original Message -----
From: "Jeff Barr" <[EMAIL PROTECTED]>
To: "Obantec Support" <[EMAIL PROTECTED]>
Sent: Friday, December 19, 2003 2:13 PM
Subject: Re: [phpxmlrpc] getting results from server ok but!

Obantec Support wrote:

i have put together a php script to access a whois server that uses xml.
now i used their guides to send correct format of message but am lost as


how to use the response.

You need to take the results apart using functions such as value, scalarval, and structmem. If your function returned a single value you would do something like this:

  $Val       = $result->value();
  $ScalarVal = $Val->scalarval();

If it returned a structure with name and age members:

  $Val     = $result->value();
  $NameVal = $Val->structmem("name");
  $AgeVal  = $Val->structmem("age");
  $Name    = $NameVal->scalarval();
  $Age     = $AgeVal->scalarval();

Make sense?


is there some function that parses the xml so i can access results.
currently i am dumping to screen using

$result = $client->send($message);// send request

// error handler in here

print_r(get_object_vars($result)); // show result to screen

(i am new to both php and xml but have programmed in perl).

Sorry if question is a bit OT, i was going to ask how to get results


server but googled my way thru my problems.


_______________________________________________ phpxmlrpc mailing list [EMAIL PROTECTED]

phpxmlrpc mailing list

_______________________________________________ phpxmlrpc mailing list [EMAIL PROTECTED]

Reply via email to