For the complete documentation index, see llms.txt. This page is also available as Markdown.

ZIP/邮政编码

按 ZIP 代码定位住宅代理。了解如何将 postalcode 参数与国家代码结合使用,以实现精确的美国位置定位。

要通过邮政编码连接代理,请添加并指定 postalcode 参数,并使用一个 五位数的 用户名中的邮政编码。此参数必须与国家代码参数结合使用 cc 以及一个不区分大小写的 2 字母国家代码 3166-1 alpha-2 格式.

以下是用户名示例: customer-USERNAME-cc-US-postalcode-90210

目前我们仅支持基于美国的代码用于 ZIP code 定位。

使用 ZIP code 的代理位置通过以下方式匹配: MaxMind IP 地理定位 数据库。在将 IP 地址与其他 IP 地理定位数据库进行比对时,ZIP code 可能会不匹配。

代码示例

在此示例中,对 ip.oxylabs.io/location 是通过位于美国、带有 ZIP code 的代理执行的 90210:

curl -x pr.oxylabs.io:7777 -U "customer-USERNAME-cc-US-postalcode-90210:PASSWORD" https://ip.oxylabs.io/location
<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$country = 'US';
$postalcode = '90210';
$proxy = 'pr.oxylabs.io:7777';
$query = curl_init('https://ip.oxylabs.io/location');
curl_setopt($query, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($query, CURLOPT_PROXY, "http://$proxy");
curl_setopt($query, CURLOPT_PROXYUSERPWD, "customer-$username-cc-$country-postalcode-$postalcode:$password");
$output = curl_exec($query);
curl_close($query);
if ($output)
    echo $output;
?>
import urllib.request
import random
username = 'USERNAME'
密码 = 'PASSWORD'
country = 'US'
postalcode = '90210'
entry = ('http://customer-%s-cc-%s-postalcode-%s:%s@pr.oxylabs.io:7777' %
    (username, country, postalcode, password))
query = urllib.request.ProxyHandler({
    'http': entry,
    'https': entry,
})
execute = urllib.request.build_opener(query)
print(execute.open('https://ip.oxylabs.io/location').read())

这有帮助吗?