VeryPDF Cloud API Platform is now support Load Balancing Servers and Redundancy Servers. Redundant High-Availability Cloud Server Load Balancing for VeryPDF Cloud APIs

VeryPDF Cloud API Platform:

http://www.verypdf.com/online/cloud-api/index.html

VeryPDF Cloud API Platform is now support Load Balancing Servers and Redundancy Servers, this will provide 100% Uptime Service Level.

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

image

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.,

http://online.verypdf.com/api/?apikey=XXXX-XXXX-XXXX-XXXX&app=html2pdf&infile=http://www.verypdf.com/online/cloud-api/index.html&outfile=verypdf.pdf

if you get no response or timeout problem with "http://online.verypdf.com/" URL, this may because high CPU usage, server maintenance, software upgrade, 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.,

http://api.verypdf.com/api/?apikey=XXXX-XXXX-XXXX-XXXX&app=html2pdf&infile=http://www.verypdf.com/online/cloud-api/index.html&outfile=verypdf.pdf

Please Notice:

1. You need replace "XXXX-XXXX-XXXX-XXXX" with your real APIKEY.

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

image

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

<?php

error_reporting(E_ALL);
ini_set('display_errors', true);
set_time_limit(300);

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

$strCmd = '?apikey=XXXX-XXXX-XXXX-XXXX&app=html2pdf&infile=http://www.verypdf.com/online/cloud-api/index.html&outfile=verypdf.pdf';

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

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);
    curl_close($ch);

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

If you encounter any problem, please feel free to let us know, we will assist you asap,

http://support.verypdf.com/open.php

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

This entry was posted in VeryPDF Cloud API and tagged . Bookmark the permalink.

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!