Search code examples
phpcpanelfopenphp-7.2

Creating Emails with PHP 7.2 Script on cPanel


I'm trying to create email accounts in cPanel with a PHP 7.2 script.

I looked into a lot of different methods posted here on stackoverflow and other guides. What I've found are these 2 different fopen() methods. Both of them direct me to the cpanel website with some errors.

I'm trying to test the methods by typing the url into a browser window and seeing the response.

I'm using hosting24 as you can see on the 2. line of code. I'm also replacing all the variables with the correct regex input, as well as the USER_CODE & CPSESSCODE.

First line of code tells me: Invalid Security Token

Second line tells me: The security token is missing from your request.

fopen("https://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/doaddpop.html?email=$emailname&domain=$emaildomain&password=$emailpass&quota=$quota", "r");

fopen("USER_CODE.hosting24.com:2083/cpsessCPSESSCODE/frontend/paper_lantern/mail/doaddpop.html?email=$emailname&domain=$emaildomain&password=$emailpass&quota=100", "r");

All hints are appriciated.


Solution

  • Solution:

    Either turn of Security Tokens in cPanel or use an API to generate them.