发起请求
查看如何使用用户名和密码认证通过独享数据中心代理发起请求。查找用于快速测试的代码示例。
发出请求到 https://ip.oxylabs.io/location 使用您列表中的第一个独享数据中心代理。替换 USERNAME 和 PASSWORD 为您的代理用户凭证。
curl -x ddc.oxylabs.io:8001 -U "user-USERNAME:PASSWORD" https://ip.oxylabs.io/location 请注意,您必须按照上面的示例构建用户名字符串才能成功发出请求。将 user- 字符串附加到您的用户名,并注意凭证区分大小写。
代码示例
curl -x ddc.oxylabs.io:8001 -U "user-USERNAME:PASSWORD" https://ip.oxylabs.io/location import requests
username = 'USERNAME'
password = 'PASSWORD'
proxy = 'ddc.oxylabs.io:8001'
proxies = {
"https": ('https://user-%s:%s@%s' % (username, password, proxy))
}
response=requests.get("https://ip.oxylabs.io/location", proxies=proxies)
print(response.content)const axios = require("axios");
const https = require("https");
const client = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false,
}),
});
const username = 'USERNAME';
const password = 'PASSWORD'
client
.get("https://ip.oxylabs.io/location", {
proxy: {
protocol: "https",
host: "ddc.oxylabs.io",
port: 8001,
auth: {
username: `user-${username}`,
password: password,
},
},
})
.then((res) => {
console.log(res.data);
})
.catch((err) => console.error(err));
您代理列表中的第一个 IP 将始终使用该8001 端口。要使用不同的代理发出请求,您需要查找您的 代理列表 并从那里获取端口值。
最后更新于
这有帮助吗?

