Moving directories to newly created domains using cPanel XML-API


Jan 29, 2013
cPanel Access Level
Website Owner
Moving directories to newly created Domains using Cpanel XML-API(Implementing FTP dynamically using PHP)
Hello folks
I am working on an application which allows user to select his own domain and create his webpages and later publish them to the web.Now I want to create a domain with what the user chooses the name to be.So,I went through documentation and learnt about the XML-API class.So,I was able to create the domains dynamically using the
and its function
which takes username,passwd and domain name as parameters.
Now in my case the user can create few pages and save them as a draft copy to be able to edit them later.Once he is done,he can publish the page to his selected domain.
I am not sure how can I move the users work on a server directory where I have initially saved it to his published domain.
For example:He creates 2 pages and saves them they are saved in a folder.Now,when he publishes,he selects a domain named want to transfer all his work(folder) to and redirect him to that page.Normally I would use a FTP tool like Filezilla to connect to the domain and upload files.But here,may be I need to dynamically connect to FTP and perform the transfer.

I have the created domain.I was thinking to add an entry to the database with his domain name and then add the transfer logic.How the transfer logic would work as the site where he is working is a different domain and the site to copy is a different domain.

Any help would be appreciated.I am very new to this to excuse for any mistake.Thank you for your time!
Last edited: