Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

PHP login to account for FTP & DB access

Discussion in 'cPanel Developers' started by skyfe, Sep 14, 2013.

  1. skyfe

    skyfe Registered

    Joined:
    Mar 19, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    51
    Hi there,

    I'm new to the WHM/CPanel API but I need it to create accounts automaticly with PHP (which I got to work) and then upload files to it and create a DB automaticly too. However I didn't find any functionality for that part.

    However I assume it is possible to automaticly upload files to a specific CPanel account using PHP?

    If anyone could help me out / point me in the correct direction, thanks in advance!

    Best regards,
    Skyfe.

    EDIT: Figured out how to create a database Matt's API, but not yet how to upload files, if anyone knows how to..?
     
    #1 skyfe, Sep 14, 2013
    Last edited: Sep 14, 2013
  2. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    68
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    If the files are the same for each account, you can use the skeleton directory for this:

    Skeleton Directory

    If not, you can use the Fileman::savefile() API2 call to create a file from a string:

    Fileman Module Documentation

    You can also use the account's username and password to connect via FTP using the built-in PHP FTP functions:

    PHP: FTP - Manual
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,827
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    For other users that may browse this thread, I wanted to point out that the official gitHub repo for the XML-API PHP client class referred to is maintained at:

    https://github.com/CpanelInc/xmlapi-php

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice