Short Tag – Web Development Blog

Entries for the ‘cPanel’ Category

Make cPanel Api2 Requests with Jquery and Javascript

First, include jQuery in your page:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

Here is the API 2 of cPanel:
http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api2/WebHome
Find the modules and function names you need, and use them when calling the function below.
Copy the following function to your webpage:

function cpanel_call(module, fct, domain, user, password, secure, port, json, callback, return_as, async)
{
var protocol = secure ? "https" : "http";
var data_type = json [...]

PHP MIME E-mail decoding with PEAR’s MimeDecode

In my previous article “PHP e-mail PIPE, cPanel PIPE forwarding” I was explaining how you can create an e-mail PIPE and get the e-mail with PHP.
This is the code you should use to get the email from stdin:

// read from stdin
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
fclose($fd);

Now, we have the content [...]

PHP e-mail PIPE, cPanel PIPE forwarding

E-mail PIPEs are e-mail forwarders that forward an email to an application and not an other email address. Recently I had to develop such a script so I thought I could share what I learned with you.
1.) Setting up the PIPE
Firstly you have to make sure your web hosting provider allows you to create E-mail [...]