[ERROR] Please provide a valid APIKEY.
If you have not a APIKEY, please sign up an account on "https://online.verypdf.com" site, you will get a valid APIKEY at "https://online.verypdf.com/wp-admin/accountinfo.php" page. If you do not provide a valid APIKEY, VeryPDF Cloud API will work at DEMO mode. If you need any assistance, please feel free contact us via VeryPDF Ticket System at "http://support.verypdf.com".
Some Examples to call VeryPDF Cloud API:
PHP Example for VeryPDF Cloud API:
//The Code
/* gets the data from a URL */
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
//The Usage
$returned_content = get_data('https://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=html2image&infile=https://www.verypdf.com&outfile=verypdf.jpg');
echo $returned_content;
curl Example for VeryPDF Cloud API:
curl 'https://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=html2image&infile=https://www.verypdf.com&outfile=verypdf.jpg'
curl --request GET 'https://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=html2image&infile=https://www.verypdf.com&outfile=verypdf.jpg'
C# Example for VeryPDF Cloud API:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.Serialization;
using System.Net;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string url = "https://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=html2image&infile=https://www.verypdf.com&outfile=verypdf.jpg";
WebRequest request = HttpWebRequest.Create(url);
WebResponse response = request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string urlText = reader.ReadToEnd();
MessageBox.Show(urlText);
}
}
}
VB.NET Example for VeryPDF Cloud API:
Imports System.IO
Imports System.Net
Module Module1
Sub Main()
'Address of URL
Dim URL As String = "https://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=html2image&infile=https://www.verypdf.com&outfile=verypdf.jpg"
' Get HTML data
Dim client As WebClient = New WebClient()
Dim data As Stream = client.OpenRead(URL)
Dim reader As StreamReader = New StreamReader(data)
Dim str As String = ""
str = reader.ReadLine()
Do While str <> Nothing
Console.WriteLine(str)
str = reader.ReadLine()
Loop
End Sub
End Module
Java Example for VeryPDF Cloud API:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.io.*;
public class VeryPDFCloudAPI
{
public static void main(String[] args) throws Exception
{
System.out.println("[Message] Enter main application...");
String strOutFile = "verypdf.jpg";
String strCloudAPIURL = "https://online.verypdf.com/api/?apikey=XXXX-XXXX-XXXX-XXXX&app=html2image&infile=https://www.verypdf.com&outfile=" + strOutFile;
VeryPDFCloudAPIConverter(strCloudAPIURL, strOutFile);
strOutFile = "verypdf.pdf";
strCloudAPIURL = "https://online.verypdf.com/api/?apikey=XXXX-XXXX-XXXX-XXXX&app=html2pdf&infile=https://www.verypdf.com&outfile=" + strOutFile;
VeryPDFCloudAPIConverter(strCloudAPIURL, strOutFile);
}
public static void VeryPDFCloudAPIConverter(String strCloudAPIURL, String strOutFile) throws Exception
{
String strResults = doHttpUrlConnectionAction(strCloudAPIURL);
strResults = strResults.replace("[Output]", "");
strResults = strResults.replace("<br>", "");
strResults = strResults.replace(" ", "");
System.out.println("[CloudAPI Return] " + strResults);
File file = new File(".");
String strLocalFile = file.getCanonicalPath()+"\\"+strOutFile;
DownloadFileFromURL(strResults, strLocalFile);
}
public static void DownloadFileFromURL(String strFileURL, String destinationFile) throws IOException
{
System.out.println("[From] "+strFileURL);
System.out.println("[To] "+destinationFile);
URL url = new URL(strFileURL);
InputStream is = url.openStream();
OutputStream os = new FileOutputStream(destinationFile);
byte[] b = new byte[2048];
int length;
while ((length = is.read(b)) != -1) {
os.write(b, 0, length);
}
is.close();
os.close();
}
private static String doHttpUrlConnectionAction(String desiredUrl) throws Exception
{
System.out.println("[CloudAPI URL] " + desiredUrl);
URL url = null;
BufferedReader reader = null;
StringBuffer stringBuffer;
try
{
// create the HttpURLConnection
url = new URL(desiredUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// just want to do an HTTP GET here
connection.setRequestMethod("GET");
// uncomment this if you want to write output to this url
//connection.setDoOutput(true);
// give it 15 seconds to respond
//connection.setReadTimeout(15*1000);
connection.connect();
// read the output from the server
reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
stringBuffer = new StringBuffer();
String line = null;
while ((line = reader.readLine()) != null)
{
stringBuffer.append(line + "\n");
}
return stringBuffer.toString();
}
catch (Exception e)
{
e.printStackTrace();
throw e;
}
finally
{
// close the reader; this can throw an exception too, so
// wrap it in another try/catch block.
if (reader != null)
{
try
{
reader.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
}
}
}
VeryPDF Cloud API Platform Home Page
VeryPDF Cloud API Archives
If you have any question for VeryPDF Cloud API Platform, please feel free contact us,
http://support.verypdf.com/open.php