cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,307
2,239
363
cPanel Access Level
Root Administrator
Hey there! As you've found, the WHM integrations are very limited, so there likely are not any PHP examples out there.

I have an older example I wrote several years ago with Perl that shows how you can add a token to verify your call:


but I'm not sure how much of that would apply to a PHP environment.
 

manoaratefy

Well-Known Member
Nov 17, 2018
58
5
8
Madagascar
cPanel Access Level
Root Administrator
Twitter
Hello,

Thank you. Your documentation talk about using access hash but as far as I know, access hash is deprecated. Another method is to use API token but I think it's not a good idea to create an API token per WHM user, and I'm risking to break my module if someone delete its API token.

Is there any way to log in into WHM API other than these two methods?
 

manoaratefy

Well-Known Member
Nov 17, 2018
58
5
8
Madagascar
cPanel Access Level
Root Administrator
Twitter
Hello,

Finally, I went by running whmapi1 binary using shell_exec PHP function to call WHM and cPanel API. Also, I've found that running whmapi1 provide me better performance than calling the API throught cURL on "127.0.0.1" (0.01 sec difference).
 
  • Like
Reactions: cPRex