I want to login at cPanel through Php script and need to modified some file from the file manager.
I have cPanel username and password also but file modification I want through PHP script no by graphically.
I will use file_put_content for modified the file from the file manager.
See below code:
2
Answers
Yes, there is a way, CPanel has an API that can be used by PHP. Example from the docs:
Elements required to make this functionality are –
And for Accesshash key , New or already generated Access key can get from here:-
WHM > Remote Access Key area and the Access Key located there.
or it should be at this path “/usr/local/cpanel/bin/realmkaccesshash
Once you get all these details , you can follow the code steps as:-
once you get this URL, you can directly open this in a new tab or same tab and you must get logged in.
It generates the similar session as cpanel login and provides you all that specific cpanel privileges.
Remeber that it only logs you in with given specific account, not for all cpanel accounts access within a server.