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.
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.
-
- 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).

Query parameters

Parameter
Description
Default Value
source
Data source. More info.
bing_search
domain
Domain localization for Bing. 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 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.
-
- 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
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.