on my web server delpop function is not working but I tried php code for addpop, passwdpop and editquota these functions are working. Can anybody tell me thye solution.
Thanks.
on my web server delpop function is not working but I tried php code for addpop, passwdpop and editquota these functions are working. Can anybody tell me thye solution.
Thanks.
Kindly check the apache error logs for the exact error message when accessing your php page. You can check it from /usr/local/apache/logs/error_log.
Please let us know greater detail so that the issue can be more accurately diagnosed:
1.) What is the specific PHP code being used?
2.) When using the PHP script, are there any errors logged? Look in both the PHP error_log (if one exists, perhaps in the same directory as the PHP script being executed) as well as looking in the cPanel error_log in "/usr/local/cpanel/logs/".
3.) What method is being used to authenticate via the PHP script? Are you using a cPanel username and password, or a hash generated via WHM at the following menu path? ( WHM: Main >> Cluster/Remote Access >> Setup Remote Access Key )
I recommend referring to our official documentation, as noted below:
Last edited by cPanelDon; 05-18-2010 at 09:29 PM. Reason: Clarification
cPResources: Submit a Support Request - Submit a Bug Report - Review existing Tickets-- Donald cPanelDon Holl - Analyst, cPanel Quality Assurance
Hi, I am using following code for using delpop function
http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/dodelpop.html?&email=$email&domain=$cpdomain
instead of dodelpop I tried delpop also but both codes did not return any errors.
thanks.
Hi devendradb,
I suppose that the sample URL that you provided *might* work, however that is not the recommended way.
Like Donald suggested, you should make you requests using an API call. One way we recommend doing this is by using the XML-API binary and passing the API1 or API2 call to it. It's easy, you can do it remotely or on the localhost.
One of the most convenient ways to make send requests to the XML-API binary is by using the XML-API PHP client class.
http://sdk.cpanel.net/lib/xmlapi/php..._v1.0.5.tar.gz
Once you have that, you can do something like this:
By using the PHP class, you can easily handle the authentication. If you don't use the PHP class, then you could make the same URL requests -- just make sure to send the proper authentication headers.Code:<?php include("xmlapi.php"); $ip = "10.1.1.1"; $xmlapi = new xmlapi($ip); $xmlapi->set_port('2083'); $cpuser = "someone"; $cppass = "pass123"; $xmlapi->password_auth($cpuser,$cppass); //$xmlapi->set_debug(1); // to add a pop email // $add = array( 'email' => "testname", 'password' => "testpass123", 'domain' => "thisdomain.com", 'quota'=>0); $xmlapi->api2_query('someone','Email','addpop',$add); // to delete a pop email // $del = array( 'email' => "testname", "domain" => "thisdomain.com"); $xmlapi->api2_query('someone','Email','delpop',$del); ?>
An example URL of delpop: (conveniently generated from debug mode in the PHP client class)
Regards,Code:URL: https://10.1.1.1:2083/xml-api/cpanel DATA: email=testname&domain=thisdomain.com&user=someone&cpanel_xmlapi_module=Email&cpanel_xmlapi_func=delpop&cpanel_xmlapi_apiversion=2 Authentication Header: Authorization: Basic c29tZW9uZZpmYXNzMTIz
-David
David Neimeyer
Integration Developer
sdk.cpanel.net
APIs: XML-API API1 & API2
Check Out: Developer Downloads Integration Blog
Need Support? Support Ticket Developer Forum Feature Request
Thanks David. This api worked fine thank you very much.
- Devendra
Hi David,
Now I am trying new API functions but I am not able to extract correct data out of response.
example: I am using listpopswithdisk API but I am not able to seperate each user or email id out of returned simpleXMLElement Object.
I can just display whole string. (print_r($r))
thanks in advance.
please see:
PHP: SimpleXML Basic usage - Manual
so, if you wanted to list out all of the usernames, you would want to do something like:
PHP Code:include("xmlapi.php");
$ip = "127.0.0.1";
$root_pass = "testpassword";
$account = "someuser";
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi->set_output("simplexml");
$resp = $xmlapi->api2_query($account, "Email", "listpopswithdisk" );
foreach ( $resp->data as $email_user ) {
print $email_user->email . "\n";
}
Hi Matt,
Thanks for the help. I tried the code, now I got the correct result. i can now able to put each user in <select> drop down menu.
Thanks.