Closed ghost closed 8 years ago
is this happen when the $arguments is null?
no, this happen when is has one item in array.
Try it again
tks guy :)
Use dev-master instead, i still haven't pushed it as a tag. :+1:
This is still a problem because the $arguments
parameter of __call()
is always an enumerated array containing the parameters passed to the method.
$accounts = listaccts(['searchtype'=>'domain', 'search'=>'', 'exact', 'search'=>'helloworld.com']);
This would result in the following $arguments
:
array(1) {
[0]=>
array(3) {
["searchtype"]=>
string(6) "domain"
["search"]=>
string(14) "helloworld.com"
[0]=>
string(5) "exact"
}
}
Which results in the following POST request:
> POST /json-api/listaccts?0%5Bsearchtype%5D=domain&0%5Bsearch%5D=helloworld.com&0%5B0%5D=exact HTTP/1.1
Hello,
This issue still not resolved. There is code like this:
include_once ('class.cpanel.php');
$cpanel = new Cpanel();
$account_info = $cpanel->callWHMApi('accountsummary',
[
, 'domain' => "domain.tld"
]
);
if ( isset($account_info) ) {
$result = json_decode ( $account_info, true );
$results = $result[ 'data' ][ 'acct' ][0];
$cgi_domain = $results[ 'domain' ];
$cgi_inodes = $results[ 'inodesused' ];
$cgi_mailboxes = $results[ 'maxpop' ];
$cgi_mailsperhour = $results[ 'max_email_per_hour' ];
$cgi_outgoingmail = $results[ 'outgoing_mail_suspended' ];
$cgi_suspended = $results[ 'suspended' ];
$cgi_suspend_reason = $results[ 'suspendreason' ];
$cgi_ip = $results[ 'ip' ];
$cgi_plan = $results[ 'plan' ];
$cgi_user = $results[ 'user' ];
$cgi_diskused = $results[ 'diskused' ];
$cgi_maxsql = $results[ 'maxsql' ];
$cgi_disklimit = $results[ 'diskused' ];
}
Code executed and result received, but with notice:
Notice: Undefined offset: 0
Sure, I can use "@" to supress that dirty notice, but it's not the best way...
I has get error when dumpzone.
Resolve: change
'query' => count($arguments) > 1 ? $arguments : $arguments[0],
to'query' => $arguments,
Please check it :)