Skip to main content

XML API accessing response data

Comments

2 comments

  • N1ghteyes
    right. After much messing about i descovered why this wasnt working. The data inside the object is also stored as an object. so for example, inside the origonal print_t() we had this: SimpleXMLElement Object ( [acct] => SimpleXMLElement Object ( [backup] => 0 [disklimit] => 2000M [diskused] => 372M [domain] => *** => *** [ip] => *** [is_locked] => 0 [legacy_backup] => 1 [max_defer_fail_percentage] => unlimited [max_email_per_hour] => unlimited [maxaddons] => *unknown* [maxftp] => unlimited [maxlst] => unlimited [maxparked] => 2 [maxpop] => unlimited [maxsql] => unlimited [maxsub] => unlimited [min_defer_fail_to_trigger_protection] => 5 [owner] => *** [partition] => home [plan] => Standard [shell] => /usr/local/cpanel/bin/noshell [startdate] => 14 Feb 14 15:58 [suspended] => 0 [suspendreason] => not suspended [suspendtime] => SimpleXMLElement Object ( ) [theme] => x3 [unix_startdate] => 1392393516 [user] => *** ) [status] => 1 [statusmsg] => Ok )
    so the structure would normally be something like $account(object)->acct(object)->disklimit(object)->2000M(string) infact whats happening is that the values are also objects. The end result is that when attempting to access those values you instead key a key'd object, hence the: SimpleXMLElement Object ( [0] => ar13bakk )
    to resolve the issue for now you can typecast with [PHP] $disklimit = (string)$account->acct->disklimit; [/PHP] hardly ideal but it works for now. If i get a chance, i'll see about posting a more perminent solution
    0
  • cPanelMichael
    Hello :) Thank you for updating the thread with an initial solution to the problem you presented. Thank you.
    0

Please sign in to leave a comment.