代理示例:
StormProxies使用 基础访问身份验证,要求您在连接代理服务器时供应用户名和密码。您可以在登录后通过个人中心 代理账号 中管理您的用户列表。或者联系专属客户经理和技术支持团队获取您的凭证。
将代码中的 USERNAME
和 PASSWORD
替换为您的凭据内容。
sessid
require 'uri'; require 'net/http'; uri = URI.parse('https://ip.oxylabs.io/') proxy = Net::HTTP::Proxy('pr.oxylabs.io', 7777, 'customer-USERNAME', 'PASSWORD') req = Net::HTTP::Get.new(uri.path) result = proxy.start(uri.host,uri.port) do |http| http.request(req) end
默认情况下您的每次请求都将使用不同的IP发出请求,您可以通过控制会话标识来保持多次请求时使用相同的IP。
会话控制参数放置在密码中,格式如下:PASSWORD[_area-jp][_session-1312121[_life-2]]
(不包含其中出现的
[
和 ]
)
参数 PASSWORD
替换为您的凭据密码。
参数 _area
为可选参数,用于指定IP归属地区或地区,多个使用英文逗号分隔,但最多不能超过5个。例如:_area-JP,KR,US,GB,FR
表示从日本、韩国、美国、英国、法国IP池中筛选一个IP作为出口IP。
参数 _session
为可选参数,用于指定会话标识,会话标识相同时会使用相同的出口IP。长度需要控制在16个字符以内。仅支持数字、字母。
参数 _life
为 _session
的可选参数, _life
不能独立出现,必须放置在
_session
之后。该参数为控制会话有效期,单位(分钟)。最长不能超过60分钟。
无会话控制请求,每次都将随机使用一个IP发出:
指定地区,使用指定地区的IP:
保持会话,在IP可用期间保持不变:
保持会话,每隔1分钟自动更换新的IP:
<?php
// 设置IP,格式 IP:PORT
$proxyServer = "USERNAME:PASSWORD@IP:PORT";
$ch = curl_init();
// 设置请求地址
curl_setopt($ch, CURLOPT_URL, "https://proxy.stormip.cn/ip/info");
// 设置IP,格式 http://ip:port
curl_setopt($ch, CURLOPT_PROXY, "http://$proxyServer");
$output = curl_exec($ch);
if ($output === FALSE) {
echo "CURL Error:" . curl_error($ch);
} else {
echo $output;
}
curl_close($ch);
import okhttp3.*; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Proxy; import java.util.Base64; public class DemoProxy { public static void main(String[] args) throws IOException { String targetUrl = "https://proxy.stormip.cn/ip/info"; String ip = "代理服务器IP"; // 代理服务器IP int port = 代理服务器端口; Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(ip, port)); String headerKey = "Proxy-Authorization"; String headerValue = "Basic " + Base64.getEncoder().encodeToString("USERNAME:PASSWORD".getBytes()); OkHttpClient client = new OkHttpClient.Builder() .proxy(proxy) .build(); Request request = new Request.Builder() .url(targetUrl) .addHeader(headerKey, headerValue) .build(); Response response = client.newCall(request).execute(); System.out.println(response.body().string()); } }
import requests # test request url targetUrl = "https://proxy.stormip.cn/ip/info" # 设置IP服务器 httpProxyServer = 'USERNAME:PASSWORD@IP:PORT' # 配置IP,根据需要配置http和https # http 网站要配置 http,https网站要配置https proxies = { "http": 'http://{}'.format(httpProxyServer), "https": 'http://{}' . format(httpProxyServer), } # 请求url1 print("request ==============================") resp = requests.get(targetUrl, proxies=proxies) print(resp.status_code) print(resp.text)
package main import ( "fmt" "golang.org/x/net/proxy" "io/ioutil" "net/http" "net/url" "os" ) func httpProxy(targetUrlString, httpProxyServer string) { targetUrl := url.URL{} //配置IP服务器 proxyServer, _ := targetUrl.Parse("http://" + httpProxyServer) //设置一个http客户端 client := &http.Client{ Transport: &http.Transport{ //设置IP服务器 Proxy: http.ProxyURL(proxyServer), }, } //访问地址 rqt, err := http.NewRequest("GET", targetUrlString, nil) if err != nil { println("请求网站失败") return } //处理返回结果 response, _ := client.Do(rqt) defer response.Body.Close() //读取内容 body, err := ioutil.ReadAll(response.Body) if err != nil { return } //输入响应结果 fmt.Println("socket5 请求结果:", string(body)) } func main() { httpProxy("https://proxy.stormip.cn/ip/info", "USERNAME:PASSWORD@IP:PORT") }
SwitchyOmega(Chromium系列浏览器插件)
适用于:Google Chrome、MicroSoft Edge、360浏览器极速版、世界之窗浏览器

Proxifier
适用于:Windows、macOS,官网地址:www.proxifier.com

这些是您在使用我们的住宅代理池时可以获得的最常见的响应代码。如果您收到任何其他响应代码,请联系您的专门客户经理了解更多信息。
400
错误的请求407
需要代理验证500
内部服务器错误502
坏门522
超时525
找不到出口注意:因动态线路仅保持短时间内有效,以下地区列表并不保证随时都有可用IP,实时列表可以咨询销售代表处。
以下仅展示部分地区或地区,更多支持区域请咨询销售代表处。