Oxylabs Documentation
English
Search
K

Maps

The google_maps source is designed to retrieve Google Local search results.
To make use of the Google Maps functionality related to hotel search, please send a search phrase with the 'hotels' word inside, e.g. hotels in Los Angeles, hotels in Paris, France, etc. Both hotel and hotels work. Google also supports local languages, so you can send Hotelli Helsingissä for hotels in Helsinki or viešbučiai Vilnius for hotels in Vilnius.

Query parameters

Parameter
Description
Default Value
source
Data source. More info.
google_maps
domain
Domain localization for Google. The full list of available domains can be found here.
com
query
UTF-encoded keyword
-
start_page
Starting page number
1
pages
Number of pages to retrieve.
1
limit
Number of results to retrieve in each page.
10
locale
Accept-Language header value which changes your Google search page web interface language. More info.
-
geo_location
The geographical location that the result should be adapted for. Using this parameter correctly is extremely important to get the right data. For more information, read about our suggested geo_location parameter structures here.
-
user_agent_type
Device type and browser. You can find the full list here.
desktop
render
Enables JavaScript rendering. More info.
callback_url
URL to your callback endpoint. More info.
-
context: results_language
Result language filter. You can find the list of supported Google languages here.
-
context: nfpr
true will turn off spelling auto-correction.
false
context: hotel_occupancy
Number of guests. NB: this parameter is only applicable if you are searching for a hotel-related search term.
2
context: hotel_dates
Length for staying in the hotel, from - to. Example: 2023-07-12,2023-07-13 NB: this parameter is only applicable if you are searching for a hotel-related search term.
-
- required parameter

Code examples

In this example, we make a request to retrieve the first 3 pages of hotel availability for 1 guest between 2023-10-01 and 2023-10-10 for hotels in Paris from google.com.sons.
JSON
cURL
Python
PHP
HTTP
{
"source": "google_maps",
"domain": "com",
"pages": 3,
"query": "hotels in Paris",
"context": [
{
"key": "hotel_occupancy",
"value": 1
},
{
"key": "hotel_dates",
"value": "2023-10-01,2023-10-10"
}]
}
curl --user "user:pass1" 'https://realtime.oxylabs.io/v1/queries' -H "Content-Type: application/json" -d '{"source": "google_maps", "domain": "com", "pages": 3, "query": "hotels in Paris", "context": [{"key": "hotel_occupancy", "value": 1}, {"key": "hotel_dates", "value": "2023-10-01,2023-10-10"}]}'
import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'google_maps',
'domain': 'com',
'query': 'hotels in Paris',
'pages': 3,
'context': [
{'key': 'hotel_occupancy', 'value': 1},
{'key': 'hotel_dates', 'value': '2023-10-01,2023-10-10'},
],
}
# Get response.
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('user', 'pass1'),
json=payload,
)
# Print prettified response to stdout.
pprint(response.json())
<?php
$params = [
'source' => 'google_maps',
'domain' => 'com',
'query' => 'hotels in Paris',
'pages' => 3,
'context' => [
[
'key' => 'hotel_occupancy',
'value' => 1,
],
[
'key' => 'hotel_dates',
'value' => '2023-10-01,2023-10-10',
]
]
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://realtime.oxylabs.io/v1/queries");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "user" . ":" . "pass1");
$headers = [];
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
echo $result;
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
https://realtime.oxylabs.io/v1/queries?source=google_maps&domain=com&query=hotels+in+Paris&pages=3&context[0][key]=hotel_occupancy&context[0][value]=1&context[1][key]=hotel_dates&context[1][value]=2023-10-01,2023-10-10&access_token=12345abcde
The example above uses the Realtime integration method. If you would like to use some other integration method in your query (e.g. Push-Pull or Proxy Endpoint), refer to the integration methods section.

HTML example