Allowing users to "switch off" their site

peasepud

Registered
Sep 15, 2007
3
0
51
I run a number of sites for different clients and am developing a Content Management system to centralise the update of these sites. One of the suggestions made would be the ability to allow users to turn their site off and stop it from being viewed.

Obviously I could do this via a php script on each site checking the flag to ensure the site is still to be shown before redirecting the page if not but would prefer not to have to do that if possible.

Is there anyway I can use a script to set a redirect up or park a domain and undirect/ unpark on demand?
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,216
12
313
Houston, TX
cPanel Access Level
Root Administrator
I run a number of sites for different clients and am developing a Content Management system to centralise the update of these sites. One of the suggestions made would be the ability to allow users to turn their site off and stop it from being viewed.

Obviously I could do this via a php script on each site checking the flag to ensure the site is still to be shown before redirecting the page if not but would prefer not to have to do that if possible.

Is there anyway I can use a script to set a redirect up or park a domain and undirect/ unpark on demand?
You can call API1 functions from the XML API as described at: http://www.cpanel.net/plugins/xmlapi/cpanel.html . API1 has functions to park/unpark a domain and you can build a PHP script to utilize the XML API.

The raw API1 call for parking a domain is:

Code:
<cpanel Park="park(example.com)">
Where example.com is the domain to park.

To unpark a domain, the API1 call is:

Code:
<cpanel Park="unpark(example.com)">
For doing a redirect domain, the API1 call is:

Code:
<cpanel Park="setredirecturl(example.com,toURL)">
Where example.com is the domain being redirected and toURL being the full URL to redirect to.