cURL
curl --request POST \
--url https://api.brightdata.com/request \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"zone": "<string>",
"url": "<string>",
"method": "GET",
"country": "<string>"
}
'import requests
url = "https://api.brightdata.com/request"
payload = {
"zone": "<string>",
"url": "<string>",
"method": "GET",
"country": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({zone: '<string>', url: '<string>', method: 'GET', country: '<string>'})
};
fetch('https://api.brightdata.com/request', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.brightdata.com/request",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'zone' => '<string>',
'url' => '<string>',
'method' => 'GET',
'country' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.brightdata.com/request"
payload := strings.NewReader("{\n \"zone\": \"<string>\",\n \"url\": \"<string>\",\n \"method\": \"GET\",\n \"country\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.brightdata.com/request")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"zone\": \"<string>\",\n \"url\": \"<string>\",\n \"method\": \"GET\",\n \"country\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brightdata.com/request")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"zone\": \"<string>\",\n \"url\": \"<string>\",\n \"method\": \"GET\",\n \"country\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"OK""Bad Request""User authentication is required"Web Unlocker & SERP API
Unlocker & SERP REST API 游乐场
POST
/
request
cURL
curl --request POST \
--url https://api.brightdata.com/request \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"zone": "<string>",
"url": "<string>",
"method": "GET",
"country": "<string>"
}
'import requests
url = "https://api.brightdata.com/request"
payload = {
"zone": "<string>",
"url": "<string>",
"method": "GET",
"country": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({zone: '<string>', url: '<string>', method: 'GET', country: '<string>'})
};
fetch('https://api.brightdata.com/request', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.brightdata.com/request",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'zone' => '<string>',
'url' => '<string>',
'method' => 'GET',
'country' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.brightdata.com/request"
payload := strings.NewReader("{\n \"zone\": \"<string>\",\n \"url\": \"<string>\",\n \"method\": \"GET\",\n \"country\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.brightdata.com/request")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"zone\": \"<string>\",\n \"url\": \"<string>\",\n \"method\": \"GET\",\n \"country\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brightdata.com/request")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"zone\": \"<string>\",\n \"url\": \"<string>\",\n \"method\": \"GET\",\n \"country\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"OK""Bad Request""User authentication is required"授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
查询参数
Set this to true for asynchronous
请求体
application/json
Name of the proxy zone which will service your request.
Target URL for your request.
Format for requesting a raw HTML via proxy is raw.
Format for request a JSON response is json.
可用选项:
raw, json Method for requesting an HTML via proxy is GET.
Country code of proxy which request is relayed through.
响应
OK
The response is of type string.
示例:
"OK"