having trouble accessing API calls

shadiadiph

Registered
Jan 29, 2010
2
0
51
Hi i have a reseller account with another company and they have cpsess enabled all my scripts i wrote using fopen used to work but they turned fopen off I have been trying to use your addpop but keep getting access denied result what can be going wrong?

Code:
<?php
include("xmlapi.php.inc");

$ip = "whr4.whrcisp4.com";
$root_pass = "mycpanelpassword";

$account = "mycpanelusername";
$email_user = "johnsmith";
$email_password = "FlubbeR678";
$email_domain = "buyandsell123.com";

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);

$xmlapi->set_debug(1);
print $xmlapi->api1_query($account, "Email", "addpop", array($email_user, $email_password, $email_domain) );
?>
returns the error

Code:
RAW API1 CALL: Emailaddpop1johnsmithFlubbeR678buyandsell123.com QUERY: https://whr4.whrcisp4.com:2083/xml-api/cpanel?user=mycpanelusername&xmlin=%3Ccpanelaction%3E%3Cmodule%3EEmail%3C%2Fmodule%3E%3Cfunc%3Eaddpop%3C%2Ffunc%3E%3Capiversion%3E1%3C%2Fapiversion%3E%3Cargs%3Ejohnsmith%3C%2Fargs%3E%3Cargs%3EFlubbeR678%3C%2Fargs%3E%3Cargs%3Ebuyandsell123.com%3C%2Fargs%3E%3C%2Fcpanelaction%3E RAW XML: 0 Access denied object(SimpleXMLElement)#2 (1) { ["data"]=> object(SimpleXMLElement)#3 (2) { ["result"]=> string(1) "0" ["reason"]=> string(13) "Access denied" } } SIMPLEXML OBJ: 
[code]

just to let you know where it says mycpanelusername uses my real username

Any help would be most appreciated
 

MattDees

Well-Known Member
Apr 29, 2005
416
1
243
Houston, TX
cPanel Access Level
Root Administrator
The interesting thing here is that if there's a token error it will state "token denied" not "access denied" so I do not think that cpsess is the issue. However I am noticing:

$xmlapi->password_auth("root",$root_pass);

since you said you have a reseller account, you may want to adjust this to the correct user.
 

shadiadiph

Registered
Jan 29, 2010
2
0
51
tried changing the user and am getting a different error

Hi Matt thanks for the reply i tried your suggestion changing root to my username but i am now getting a different error

Code:
include("xmlapi.php.inc");

$ip = "whr4.whrcisp4.com";
$root_pass = "mycpanelpassword";

$account = "mycpanelusername";
$email_user = "johnsmith";
$email_password = "FlubbeR678";
$email_domain = "buyandsell123.com";

$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("mycpanelusername",$root_pass);

$xmlapi->set_debug(1);
print $xmlapi->api1_query($account, "Email", "addpop", array($email_user, $email_password, $email_domain) );
now it returns
Code:
RAW API1 CALL: [email protected] QUERY: https://whr4.whrcisp4.com:2083/xml-api/cpanel?user=buyandse&xmlin=%3Ccpanelaction%3E%3Cmodule%3EEmail%3C%2Fmodule%3E%3Cfunc%3Eaddpop%3C%2Ffunc%3E%3Capiversion%3E1%3C%2Fapiversion%3E%3Cargs%3Ejohnsmith%3C%2Fargs%3E%3Cargs%3EFlubbeR678%3C%2Fargs%3E%3Cargs%3E%40buyandsell123.com%3C%2Fargs%3E%3C%2Fcpanelaction%3E RAW XML: Emailaddpopeventinternal1Sorry, the given email address is invalid. 1 object(SimpleXMLElement)#2 (7) { ["module"]=> string(5) "Email" ["func"]=> string(6) "addpop" ["type"]=> string(5) "event" ["source"]=> string(8) "internal" ["apiversion"]=> string(1) "1" ["data"]=> object(SimpleXMLElement)#3 (1) { ["result"]=> string(43) "Sorry, the given email address is invalid. " } ["event"]=> object(SimpleXMLElement)#4 (1) { ["result"]=> string(1) "1" } } SIMPLEXML OBJ: 
[code]

seem likes its not locking me out now but i don't see how the email address is invalid??
 

MattDees

Well-Known Member
Apr 29, 2005
416
1
243
Houston, TX
cPanel Access Level
Root Administrator
you're missing quota in your query.

try:

PHP:
print $xmlapi->api1_query($account, "Email", "addpop", array($email_user, $email_password, 0,$email_domain) );
?>