An SSL certificate allows you to establish an end-to-end encrypted connection when using Web Unlocker in native proxy mode.
If you are just doing initial testing, you can also start without an SSL certificate and use it later.
Using an SSL certificate is very simple. You can download it and then choose how to use it in your environment.
Download SSL Certificate
Click this link to "download" the file to your hard drive, and unzip the file
If you write scraping code, in most cases you do not need to install an SSL certificate in your environment. Simply load the SSL certificate in your code.
You can refer to the LunaProxy sample code example in the dashboard for the exact syntax.
Installing an SSL Certificate
In some cases, such as when using certain third-party tools that do not allow certificates to be loaded from hard disk, you still need to install an SSL certificate on your computer.
Where should I install the certificate?
The SSL certificate needs to be installed on the host where the actual scraping code or application is running.
In most cases this is your PC, but if you are using a cloud-hosted server to run your code, you will need to install the SSL certificate on the server itself.
Installation Instructions
This takes 2 minutes - just follow these instructions:
This SSL certificate is suitable for: Windows
1
Click this link to "download" the file to your hard drive,and Unzip the file
After successful installation you will be able to connect to the desired LunaProxy product (web unblocker)
How do I ignore SSL errors?
In some cases, you will need to install our certificate or ignore SSL errors to access certain products or features. If you do not want to install our certificate, you can ignore SSL errors. Looking at the following code snippets for different programming languages, the highlighted parts are what you need to add to your code to ignore SSL errors.
#!/usr/bin/env node
/*This sample code assumes the request-promise package is installed. If it is not installed run: "npm install request-promise"*/
require('request-promise')({
url: 'http://myip.lunaproxy.io',
proxy: 'http://<username>:<password>@unlocker.lunaproxy.net:13333',
// Make sure you set reject rejectUnauthorized to false
rejectUnauthorized: false,
})
.then(function(data){ console.log(data); },
function(err){ console.error(err); });
#!/usr/bin/env python
print('If you get error "ImportError: No module named \'six\'" install six:\n'+\
'$ sudo pip install six');
import sys
# Make sure you add these two line to ignore ssl error
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
if sys.version_info[0]==2:
import six
from six.moves.urllib import request
opener = request.build_opener(
request.ProxyHandler(
{'http': 'http://<username>:<password>@unlocker.lunaproxy.net:13333',
'https': 'http://<username>:<password>@unlocker.lunaproxy.net:13333'}))
print(opener.open('http://myip.lunaproxy.io').read())
if sys.version_info[0]==3:
import urllib.request
opener = urllib.request.build_opener(
urllib.request.ProxyHandler(
{'http': 'http://<username>:<password>@unlocker.lunaproxy.net:13333',
'https': 'http://<username>:<password>@unlocker.lunaproxy.net:13333'}))
print(opener.open('http://myip.lunaproxy.io').read())
using System;
using System.Net;
class Example
{
static void Main()
{
// Make sure you add this line to ignore ssl error
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
var client = new WebClient();
client.Proxy = new WebProxy("unlocker.lunaproxy.net:13333");
client.Proxy.Credentials = new NetworkCredential("<username>", "<password>");
Console.WriteLine(client.DownloadString("http://myip.lunaproxy.io"));
}
}
#!/usr/bin/ruby
require 'uri'
require 'net/http'
require 'net/https'
uri = URI.parse('http://myip.lunaproxy.io')
proxy = Net::HTTP::Proxy('unlocker.lunaproxy.net', 13333, '<username>', '<password>')
req = Net::HTTP::Get.new(uri)
# Make sure you add verify_mode => OpenSSL::SSL::VERIFY_NONE
result = proxy.start(uri.host,uri.port, :use_ssl => uri.scheme == 'https', :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
http.request(req)
send
puts result.body
package example;
import org.apache.http.HttpHost;
import org.apache.http.client.fluent.*;
public class Example {
public static void main(String[] args) throws Exception {
HttpHost proxy = new HttpHost("unlocker.lunaproxy.net", 13333);
String res = Executor.newInstance()
.auth(proxy, "<username>", "<password>")
.execute(Request.Get("http://myip.lunaproxy.io").viaProxy(proxy))
.returnContent().asString();
System.out.println(res);
}
}
/*In the above example, we are not explicitly ignoring SSL
I will share with you a short code I wrote that does ignore SSL using JAVA (was taken from cloud proxy manager examples) */
import java.io.*;
import java.net.*;
import java.security.cert.X509Certificate;
import javax.net.ssl.*;
import java.util.Base64;
public class Example {
public static void main(String[] args) throws Exception {
// Disable restricted headers for proxy authentication
System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
// Set up a TrustManager that does not validate certificate chains
SSLContext sc = SSLContext.getInstance("SSL");
TrustManager trust_manager = new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
};
TrustManager[] trust_all = new TrustManager[] { trust_manager };
sc.init(null, trust_all, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
// Set up the proxy and open a connection
URL url = new URL("http://myip.lunaproxy.io");
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("unlocker.lunaproxy.net", 13333));
URLConnection yc = url.openConnection(proxy);
// Set default Authenticator for proxy authentication
Authenticator.setDefault(new Authenticator() {
@Override
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("<username>", "<password>".toCharArray());
}
});
// Read and print the response from the server
BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
Imports System.Net
Module Module1
Sub Main()
' Make sure you add this line to ignore ssl error
ServicePointManager.ServerCertificateValidationCallback = Function(se, cert, chain, sslerror) True
Dim Client As New WebClient
Client.Proxy = New WebProxy("http://unlocker.lunaproxy.net:13333")
Client.Proxy.Credentials = New NetworkCredential("<username>", "<password>")
Console.WriteLine(Client.DownloadString("http://myip.lunaproxy.io"))
End Sub
End Module
<?php
$curl = curl_init('http://myip.lunaproxy.io');
curl_setopt($curl, CURLOPT_PROXY, 'http://unlocker.lunaproxy.net:13333');
curl_setopt($curl, CURLOPT_PROXYUSERPWD, '<username>:<password>');
// Make sure you add this line to ignore ssl error
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_exec($curl);
?>
#!/usr/bin/perl
use LWP::UserAgent;
# Make sure you add this line to ignore ssl error
use IO::Socket::SSL qw( SSL_VERIFY_NONE );
my $agent = LWP::UserAgent->new();
$agent->proxy(['http', 'https'], "http://<username>:<password>@unlocker.lunaproxy.net:13333");
$agent->ssl_opts(verify_hostname => 0, SSL_verify_mode => SSL_VERIFY_NONE);
print $agent->get('http://myip.lunaproxy.io')->content();