Overview
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/index.live.php?api=serialize';
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
// Is there a Cookie ?
if(!empty($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);
curl_close($ch);
if($resp === false){
echo 'No response received from SitePad. cURL Error : '.curl_error($ch);
exit;
}
$res_data = unserialize($resp);
// Let's redirect the user to SitePad editor server
if(!empty($res_data['redirect_url'])){
echo '<meta http-equiv="Refresh" content="0;url='.$res_data['redirect_url'].'">';
exit;
}else{
echo 'Unable to fetch SitePad URL to redirect. cURL Error : '.curl_error($ch);
exit;
}
Contact Support
In case you face any issues with integrating SitePad with your control panel, you can contact us anytime for support at support@sitepad.com.