HTML Response
API Example
curl "https://api.scrapingdog.com/google/?api_key=5eaa61a6e562fc52fe763tr516e4653&query=https://www.google.com/search?q=pizza"
import requests
# Set the API key and query parameters
api_key = "5eaa61a6e562fc52fe763tr516e4653"
query = "https://www.google.com/search?q=pizza"
# Construct the API URL
api_url = f"https://api.scrapingdog.com/google/?api_key={api_key}&query={query}"
# Send an HTTP GET request
response = requests.get(api_url)
# Check if the request was successful (status code 200)
if response.status_code == 200:
# Process the response data as needed
print(response.text)
else:
print(f"HTTP request failed with status code: {response.status_code}")
const axios = require('axios');
// Set the API key and query parameters
const apiKey = "5eaa61a6e562fc52fe763tr516e4653";
const query = "https://www.google.com/search?q=pizza";
// Construct the API URL
const apiUrl = `https://api.scrapingdog.com/google/?api_key=${apiKey}&query=${query}`;
// Send an HTTP GET request
axios.get(apiUrl)
.then(response => {
// Check if the request was successful (status code 200)
if (response.status === 200) {
// Process the response data as needed
console.log(response.data);
} else {
console.log(`HTTP request failed with status code: ${response.status}`);
}
})
.catch(error => {
console.error(`An error occurred: ${error.message}`);
});
<?php
// Set the API key and query parameters
$apiKey = '5eaa61a6e562fc52fe763tr516e4653';
$query = 'https://www.google.com/search?q=pizza';
// Construct the API URL
$apiUrl = 'https://api.scrapingdog.com/google/?api_key=' . $apiKey . '&query=' . urlencode($query);
// Initialize cURL session
$ch = curl_init($apiUrl);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the cURL request
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo 'cURL error: ' . curl_error($ch);
} else {
// Process the response data as needed
echo $response;
}
// Close the cURL session
curl_close($ch);
?>
require 'net/http'
# Set the API key and query parameters
api_key = '5eaa61a6e562fc52fe763tr516e4653'
query = 'https://www.google.com/search?q=pizza'
# Construct the API URL
api_url = URI("https://api.scrapingdog.com/google/?api_key=#{api_key}&query=#{URI.encode(query)}")
# Create an HTTP GET request
http = Net::HTTP.new(api_url.host, api_url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(api_url)
# Send the request and get the response
response = http.request(request)
# Check the response and process it as needed
if response.is_a?(Net::HTTPSuccess)
puts response.body
else
puts "HTTP Request Failed: #{response.code} - #{response.message}"
end
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class CurlToJava {
public static void main(String[] args) {
try {
String apiKey = "5eaa61a6e562fc52fe763tr516e4653";
String query = "https://www.google.com/search?q=pizza";
String apiUrl = "https://api.scrapingdog.com/google/?api_key=" + apiKey + "&query=" + query;
URL url = new URL(apiUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// Set the request method to GET
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
if (responseCode == 200) {
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = reader.readLine()) != null) {
response.append(inputLine);
}
reader.close();
System.out.println(response.toString());
} else {
System.out.println("HTTP Request Failed: " + responseCode);
}
connection.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Response
<!doctype html>
<html itemscope="" itemtype="http://schema.org/SearchResultsPage" lang="en">
<head>
<meta charset="UTF-8">
<meta content="origin" name="referrer">
<meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image">
<title>pizza - Google Search</title>
<script nonce="I_-nXks-zFztp5SjaOLwoA">
(function(){var b=window.addEventListener;window.addEventListener=function(a,c,d){"unload"!==a&&b(a,c,d)};}).call(this);(function(){var _g={kEI:'SHMyZZHRFpyi5NoP-IajUA',kEXPI:'31',kBL:'LKH9',kOPI:89978449};(function(){var a;(null==(a=window.google)?0:a.stvsc)?google.kEI=_g.kEI:window.google=_g;}).call(this);})();(function(){google.sn='web';google.kHL='en';})();(
...
...
...
(function(){for(var i in google.iir||{}){_setImagesSrc([i],google.iir[i]);}google.iir={};})();google.jslm=3;
</script>
<script nonce="I_-nXks-zFztp5SjaOLwoA">
(function(){var xsrfTokens='{\x22ff8SWb\x22:\x22ALook6ys74FdfhcGWjZ8XKB5g_X8q4XNKg:1697805129336\x22,\x22UPgwmc\x22:\x22ALook6x8xZvyHFxaFYcbxWcAmUKiESLv1A:1697805129336\x22,\x22EXtmgd\x22:\x22ALook6zHQtC4isTCpp6qN_qvYHwX124YEw:1697805129336\x22,\x22Fws7If\x22:\x22ALook6wIxt7wNBFV8C5zzGTD4ptnXpk0sg:1697805129336\x22,\x22WWkTtd\x22:\x22ALook6yhcn-iXPgi89X20GYoM91NnBaG4A:1697805129336\x22,\x22gPfwKf\x22:\x22ALook6yINj_mvILNUeEXwiiiVjiRGpwj7Q:1697805129336\x22}';google.xsrf=JSON.parse(xsrfTokens);})();
</script>
<div id="reviewDialog" data-async-context="async_id_prefix:" data-jiis="up" data-async-type="reviewDialog"
data-async-context-required="async_id_prefix" class="yp"></div>
<div id="dbg_"></div>
</div>
</body>
</html>
Last updated