I require the following functions to be created in PHP-- basically you have to create these functions, and then convert them into simple 'modules' for a billing script named Blesta-- the conversion of a function into a module is very easy- so most of the work is writing the functions themselves.
(1) Create simple PHP functions that do all operations as required by Cloud Flare Host API-- you can see a list of operations at [url removed, login to view] (All operations are POST requests to the cloudflare API). Also a php sample code is provided by cloudflare at the URL given above.
When a user signs up and orders a domain through the existing domains module in Blesta--> first connect to Rackspace CloudFiles and set up the user's domain in a new bucket in CloudFiles-- you can use existing PHP code available at [url removed, login to view] for this purpose. Once the domain is set up in a bucket in Rackspace CloudFiles, connect to CloudFlare Host API (with the functions you created) and set up the user's ordered domain in CloudFlare CDN also.
(2) One scenario is when a user has already purchased a domain elsewhere-- in this case do the same work as point 1, ie set up the domain -> Rackspace CloudFiles CDN, and after that set it up at CloudFlare CDN. But here, because the user has purchased the domain elsewhere, he has to make some changes to that domain's DNS records at his domain registrar-- just perform operations as per point 1, and at the end display whatever DNS records the user has to update/create at his domain registrar, for the site to work correctly with Rackspace and CloudFlare CDN's.
(3) One scenario-- user wants to change a domain, or define a new subdomain--> here also simply define the new subdomain first in Rackspace and then in CloudFlare.
Note the above 3 points can occur either at time of signup, or later when a user is managing his domains. (Domain may be purchased from us-> module or it may be purchased elsewhere by the user).
Also, see the list of operations as available in Rackspace CloudFiles PHP API (as present in existing library for which I have given url above) and also in CloudFlare Host API--> create one plugin for use during a user's signup, and one plugin for use when a user is managing a domain or adding/editing/deleting a subdomain etc. (Just see which all operations out of those available in Rackspace and CloudFlare APIs can be performed during sign up or maintenance and add those operations to respective plugins).
Basically the work is making requests against PHP API--> the conversion to Blesta module can be done as per [url removed, login to view]
I will also require your help later--> blesta v3 is going to come out soon and the module you create will have to be converted to make it work with v3 of Blesta.
Do let me know if you have any doubts/queries-- I will be happy to answer those for you.