How to send SERP API HTTPS requests

When targeting HTTPS, URLs data is encrypted. Therefore, in order for SERP API to decrypt the data and return the result, you will need to download and install the Bright Data Certificate or skip the SSL validation.

Here are explanations on how to send HTTPS requests:

Sending HTTPS requests without SSL validation

Shell
Use --insecure or -k flag

curl -v  --insecure --compressed --proxy brd.superproxy.io:22225 --proxy-user brd-customer-<ACCOUNT_ID>-zone-<ZONE>:<PASSWORD> "https://www.google.com/search?q=pizza&lum_json=1"

Node.js 

process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;

Java

Add the following argument to the JVM:

-Dcom.sun.net.ssl.checkRevocation=false

C#

ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;

Python

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

 

Sending HTTPS requests with SSL validation

Shell
Use the --cacert flag followed by the certificate file path:

curl -v --compressed --cacert “{cert file path}“ --proxy brd.superproxy.io:22225 --proxy-user brd-customer-{ACCOUNT_ID}-zone-{ZONE}:{PASSWORD} "https://www.google.com/search?q=pizza&lum_json=1"

Java

Import the certificate to the Java Keystore.

Example using Java keytool to import the certificate:

%JAVA_HOME% Keystore (mostly the cacerts file in ..\lib\security\).

Keytool command example:

keytool -import -alias <cert alias> -file <cert name>.cer -keystore <keystore filename> -storepass <keystore password>

After running the keytool command you will be prompted if to trust the certificate: answer ‘y’ 

Other code Languages

Follow the instructions in the following article on how to download and Install the Bright Data certificate to your local machine's Trusted Root Certification Authorities.

Was this article helpful?