Load Balancing and Redundancy Servers in VeryPDF Cloud API Platform

VeryPDF Cloud API Platform is now support Load Balancing and Redundancy Servers,

The 1st API Server is: http://online.verypdf.com/api/
The 2st API Server is: http://api.verypdf.com/api/


You can execute the following URL from your source code to convert a web page to PDF file, using curl_exec() in PHP or HttpWebRequest in C# or WebClient in VB.NET, etc.,


if you get no response or timeout problem with "http://online.verypdf.com/" URL, this may because high CPU usage, server maintenance, software upgrade, network connection problem, etc. issues, you can switch to second API Server (http://api.verypdf.com/) automatically from your source code, this will guarantee the uptime of VeryPDF Cloud API Service up to 100%, e.g.,


Please Notice:

1. You need replace "XXXX-XXXX-XXXX-XXXX" with your real APIKEY to remove the restrictions.

2. "http://online.verypdf.com/api/" and "http://api.verypdf.com/api/" have same API parameters.

The following is a sample PHP example to switch API Servers automatically,


ini_set('display_errors', true);

$strAPIServers = array();
$strAPIServers[] = 'http://online.verypdf.com/api/';
$strAPIServers[] = 'http://api.verypdf.com/api/';

$strCmd = '?apikey=XXXX-XXXX-XXXX-XXXX

$strReturnedContent = '';
foreach ($strAPIServers as $strAPIServer)
        $strURL = $strAPIServer.$strCmd;
        $strReturnedContent = VeryPDF_APIServer_Execute_URL($strURL);
        if($strReturnedContent == '')

echo $strReturnedContent;
if($strReturnedContent == '')
        die('[Error] Failed to retrieve document contents.');
$strFileURL = GetOutputFileURL($strReturnedContent);
if($strFileURL == '')
        die('[Error] Failed to get document URL.');

function GetOutputFileURL($strTextContents)
        if($strTextContents == '')
                return '';
        $searchString = "[Output] ";
        $arrayDatas = explode("\n", $strTextContents);
        if(count($arrayDatas) == 0)
                return '';
        for ($line = 0; $line < count($arrayDatas); $line++)
                if (strpos($arrayDatas[$line], $searchString) === 0)
                        $strData = str_replace($searchString, '', $arrayDatas[$line]);
                        $strData = str_replace('<br>', '', $strData);
                        return $strData;
        return '';
function VeryPDF_APIServer_Execute_URL($url)
        echo "$url<br>";

        $ch = curl_init();
        $timeout = 5;
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_HOST']);
        $data = curl_exec($ch);
        $curl_errno = curl_errno($ch);
        $curl_error = curl_error($ch);

        if ($data === false || $curl_errno > 0)
                echo "curl_exec Error ($curl_errno): $curl_error<br>";
                return '';
        return $data;

Here is an article for this Load Balancing feature,


If you encounter any problem, please feel free to let us know,


VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Verify Code   If you cannot see the CheckCode image,please refresh the page again!