Oxylabs Documentation
English
Search
K

Bing

There are two approaches to retrieving data from Bing using our SERP Scraper API. You can give us a full URL or pass parameters via the specifically built data source - Search.

Overview

Below is a quick overview of all the available data source values we support with Bing.
Source
Description
Structured data
bing
Submit any Bing URL you like.
No.
bing_search
Bing SERPs.
No.
Although we do not have dedicated parsers for Bing, you can write your own parsing instructions with Custom Parser feature and get structured data.
You can jump to your preferred Bing page type by selecting its name on the right hand side menu. Each page contains the parameter table as well as code examples to help you get started with your query.

URL

The bing source is designed to retrieve the content of direct URLs of various Bing pages. Instead of sending multiple parameters, you can provide us with a direct URL for the required Bing page. We do not strip any parameters or alter your URLs in any other way.

Query parameters

Parameter
Description
Default Value
source
Data source. More info.
bing
url
Direct URL (link) to Bing page
-
user_agent_type
Device type and browser. The full list can be found here.
desktop
geo_location
The API uses Canonical Geo Location format to determine request location. It goes like this: City,Region,Country, for example Harrisburg,Arkansas,United States).
-
callback_url
URL to your callback endpoint. More info.
-
render
Enables JavaScript rendering. More info.
-
- required parameter

Code examples

In this example, we make a request to retrieve a result for the provided URL.
JSON
cURL
Python
PHP
HTTP
{
"source": "bing",
"url": "https://www.bing.com/search?q=nike"
}
curl --user "user:pass1" 'https://realtime.oxylabs.io/v1/queries' -H "Content-Type: application/json" -d '{"source": "bing", "url": "https://www.bing.com/search?q=nike"}'
import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'bing',
'url': 'https://www.bing.com/search?q=nike'
}
# Get response.
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('user', 'pass1'),
json=payload,
)
# Instead of response with job status and results url, this will return the
# JSON response with results.
pprint(response.json())
<?php
$params = array(
'source' => 'bing',
'url' => 'https://www.bing.com/search?q=nike'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://data.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 = array();
$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);
# URL has to be encoded to escape `&` and `=` characters:
# URL: https://bing.com/search/?text=nike&
# Encoded URL: https%3A%2F%2Fbing.com%2Fsearch%2F%3Ftext%3Dnike%26
https://realtime.oxylabs.io/v1/queries?source=bing&url=https%3A%2F%2Fwww.bing.com%2Fsearch%3Fq%3Dnike&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.
The bing_search source is designed to retrieve Bing Search results pages (SERPs).
To scrape AI-generated search results from Bing, use the render parameter. Check out the code example below.

Query parameters

Parameter
Description
Default Value
source
Data source. More info.
bing_search
domain
Localize results for a certain country. Valid values: com, ru, ua, by, kz, tr.
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 Bing search page web interface language. More info.
-
geo_location
The API uses Canonical Geo Location format to determine request location. It goes like this: City,Region,Country, for example Harrisburg,Arkansas,United States).
-
user_agent_type
Device type and browser. The full list can be found here.
desktop
callback_url
URL to your callback endpoint. More info.
-
render
Enables JavaScript rendering. More info.
-
- required parameter

Code examples

In the example below, we make a request to retrieve 10 Bing SERPs, starting from the 11th page, for the search term adidas.
JSON
cURL
Python
PHP
HTTP
{
"source": "bing_search",
"query": "adidas",
"start_page": 11,
"pages": 10
}
curl --user "user:pass1" 'https://realtime.oxylabs.io/v1/queries' -H "Content-Type: application/json" -d '{"source": "bing_search", "domain": "com", "query": "adidas", "start_page": 11, "pages": 10, "callback_url": "https://your.callback.url"}'
import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'bing_search',
'domain': 'com',
'query': 'adidas',
'start_page': 11,
'pages': 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 = array(
'source' => 'bing_search',
'domain' => 'com',
'query' => 'adidas',
'start_page' => 11,
'pages' => 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 = array();
$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=bing_search&domain=com&query=adidas&start_page=11&pages=10&access_token=12345abcdep
In the following example, we send a request to retrieve AI-generated Bing search results for the search term best seo tools.
{
"source": "bing_search",
"query": "best seo tools",
"render": "html"
}
The examples above use 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.

Parameter values

Locale

Using the locale parameter will allow you to change Bing search page web interface language (not results).
For example, if you use the domain com and locale parameter de-DE, the results will still be American, but the Accept-Language header value will be set to de-DE,de;q=0.8. This would imitate a person from US searching in com domain, who has the UI of his browser set to German language.
If you don't use this parameter, we will set 'Accept-Language' parameter to match the domain (i.e. en-US for com).
Download the full list of locale values in JSON format below.
locale.json
41KB
Code

Geo_location

Bing supports a few geo_location parameter value formats.
  • City-level location. It is very straightforward. Just pass a city-level location in the City,State,Country format. Example: "geo_location": "New York,New York,United States".
  • State-level location. Strip the first part of a city-level location and pass a geo_location value in the "State,Country" format. Example: "geo_location": "California,United States".
  • Country-level location. To get results localized for the geographical center point of a country, pass an official country name. Example: "geo_location": "United Kingdom".
  • Coordinate-level location. To get hyperlocal search results (beneficial for searches such as "restaurants near me"), you can pass latitude, longitude, and radius values. The following example passes the coordinates of Space Needle in Seattle, WA: "geo_location": "lat: 47.6205, lng: -122.3493, rad: 25000".
Last modified 2mo ago