Skip to main content

Using WHM API inside plugin

Comments

4 comments

  • cPRex Jurassic Moderator
    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:
    0
  • Manoa R.
    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?
    0
  • cPRex Jurassic Moderator
    Those are the only two tools available for the API system to connect properly. Someone would need root access to the machine in order to delete the token, so it would not be randomly removed by an automated process.
    0
  • Manoa R.
    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).
    0

Please sign in to leave a comment.