Mobile Presale Preview

Overview

Create a preview to show what the visitor’s desktop site will look mobile-optimized.

Target Audience

Existing DudaPro partners or companies looking to generate leads or excitement instantly by displaying a preview of what their customers’ websites can look like on mobile.

Available For

Anyone. The Before & After preview is only available for DudaPro partners.

Essentials before getting started

Make sure you are a DudaPro partner and have set up your customized editor, dashboard, login and domains.
Requested API access and been approved. Have your API user and password keys ready.
Create an input form on your website asking users to enter a site url.

Steps to implement

Download Full implementation code: Presalepreview.zip

1) Create Site

In order to show a preview, we must create a site to display it. You will create a mobile site based on the provided URL.

API URL:

https://api.dudamobile.com/api/sites/create
Parameters:

  • site_data
  • original_site_url - the base URL of the website you want to convert (mandatory)

Success response code: [http_code] => 200

Success response: site_name

PHP Code example: (replace {parameter} with actual value)

<?php
    $data = '
        {  
        "site_data":
            {
                "original_site_url":"{original_site_url}"
           }
        }
    ';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://api.dudamobile.com/api/sites/create');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERPWD, "{your_api_username}:{your_api_password}");
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_POST,1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER,array(                                                                         
        'Content-Type: application/json',      
        'Content-Length: ' .strlen($data))                                                                      
    ); 
$output = curl_exec($ch);
    curl_close($ch);
?>

2) Get Site Preview URL

API URL: https://api.dudamobile.com/api/sites/{site_alias}

URL Parameters: site_alias - your site alias which you created in step a. (mandatory)

Parameters: none

Success response code: [http_code] => 200

PHP Code example: (replace {parameter} with actual value)

<?php
    $data = '';
 
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,'https://api.dudamobile.com/api/sites/{site_alias}');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_USERPWD, "{your_api_username}:{your_api_password}");
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER,array(                                                                         
        'Content-Type: application/json',      
        'Content-Length: ' .strlen($data))                                                                      
    );  
//Perform cURL and set result as $output
$output = curl_exec($ch);
//Decode JSON results into array
$output = json_decode($output);
curl_close($ch);
//Echo exact preview URL from array
echo $output->site_extra_info->preview_url;
?>

The above code will output the preview URL for you to share with your customers.

×

Priority Phone Support

English phone support is available 18 hours a day,
Monday through Friday, 3am to 9pm (EST).

United States +1 866-776-1550 3am to 9pm (Eastern)
United Kingdom +44 (0)800-011-9071 8am to 2am (London)
France +33 (0)9-75-18-84-74 9am to 3am (Paris)
Israel +972 (0)3-720-8922 10am to 4am (Jerusalem)
Australia +61 (0)2-8880-9166 7pm to 1pm (Sydney)
To schedule a call in French, Portuguese, Hebrew or Russian, please email us at prioritysupport@dudamobile.com
×

Please Log in as a DudaPro

Priority Phone Support is available exclusively to DudaPros. Log in to your DudaPro account now to see our international support numbers.

Log In
Not a DudaPro? Start a free trial now!