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:

Yes, there is a way, CPanel has an API that can be used by PHP. Example from the docs: