Creating Custom Link

From SitePad Wiki
Jump to: navigation, search


The following guide will show you how to create a custom link for SitePad in your custom billing panel or any other 3rd party application.

Create the Link

Creating a custom link to SitePad is useful when you want to allow your users to access SitePad from your billing panel or some other 3rd party application.

Note : This guide is to just create a link for SitePad, if you are looking to integrate SitePad with your custom control panel please refer to the following guide Integrating SitePad with custom/proprietary control panel.

In order to create such link you can use the SitePad API to get the redirect link for SitePad editor server and simply redirect the user to the link that you get in response.

We are providing the example for cPanel below, however you can use the same API with all the control panels with which SitePad is integrated.

Below is the example code for the same :

$vars['username'] = 'CPANEL_USERNAME';
$vars['password'] = 'CPANEL_PASSWORD';
$vars['ipaddress'] = 'SERVER_IP';

$url = 'https://'.rawurlencode($vars['username']).':'.rawurlencode($vars['password']).'@'.$vars['ipaddress'].':2083/3rdparty/sitepad/';

// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

// Is there a Cookie ?
	curl_setopt($ch, CURLOPT_COOKIESESSION, true);
	curl_setopt($ch, CURLOPT_COOKIE, $cookie);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Get response from the server.
$resp = curl_exec($ch);


if($resp === false){
	echo 'No response received from SitePad. cURL Error : '.curl_error($ch);

$res_data = unserialize($resp);

// Let's redirect the user to SitePad editor server
	echo '<meta http-equiv="Refresh" content="0;url='.$res_data['redirect_url'].'">';
	echo 'Unable to fetch SitePad URL to redirect. cURL Error : '.curl_error($ch);

Contact Support

In case you face any issues with integrating SitePad with your control panel, you can contact us anytime for support at