콘텐츠로 이동
로그인 가입하기

코드 통합

Shifter 게이트웨이는 p.shifter.io:443에서 일반 HTTP(S) 및 SOCKS5를 지원합니다. 프록시 인증을 지원하는 모든 언어의 HTTP(S) 클라이언트가 작동하며, SDK는 필요하지 않습니다.

사용자 이름에는 타겟팅 및 세션 설정이 인코딩되며, 비밀번호는 계정 비밀번호입니다. 전체 플래그 목록은 게이트웨이 및 인증을 참조하세요.

가장 널리 사용되는 방법은 requests와 proxies 딕셔너리를 사용하는 것입니다.

import requests
proxy = "customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443"
proxies = {"http": proxy, "https": proxy}
r = requests.get("https://ipinfo.io/json", proxies=proxies)
print(r.text)

비동기 코드의 경우 httpx도 동일한 방식으로 작동합니다 (httpx.AsyncClient(proxies=proxy)).

node-fetch(또는 Node 18 이상에 내장된 fetch)를 https-proxy-agent와 함께 사용하세요.

import fetch from 'node-fetch';
import { HttpsProxyAgent } from 'https-proxy-agent';
const agent = new HttpsProxyAgent(
'customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443'
);
const res = await fetch('https://ipinfo.io/json', { agent });
console.log(await res.text());

axios, got, undici도 모두 비슷한 agent 옵션을 지원합니다.

Node.js와 동일한 런타임이며 타입만 지정됩니다. axios를 사용한 예제입니다.

import axios from 'axios';
import { HttpsProxyAgent } from 'https-proxy-agent';
const agent = new HttpsProxyAgent(
'customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443'
);
const { data } = await axios.get<string>('https://ipinfo.io/json', {
httpAgent: agent,
httpsAgent: agent,
});
console.log(data);

트랜스파일러 없는 순수 Node CommonJS입니다.

const fetch = require('node-fetch');
const { HttpsProxyAgent } = require('https-proxy-agent');
const agent = new HttpsProxyAgent(
'customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443'
);
fetch('https://ipinfo.io/json', { agent })
.then((r) => r.text())
.then(console.log);

타사 종속성 없이 표준 라이브러리만 사용합니다.

package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
proxyURL, _ := url.Parse("customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443")
client := &http.Client{
Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)},
}
resp, _ := client.Get("https://ipinfo.io/json")
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}

프록시에 기본 인증을 사용하는 reqwest입니다.

use reqwest::blocking::Client;
use reqwest::Proxy;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let proxy = Proxy::all("http://p.shifter.io:443")?
.basic_auth("customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600", "PASSWORD");
let client = Client::builder().proxy(proxy).build()?;
let body = client.get("https://ipinfo.io/json").send()?.text()?;
println!("{body}");
Ok(())
}

내장된 java.net.http.HttpClient(Java 11 이상)입니다.

import java.net.*;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newBuilder()
.proxy(ProxySelector.of(new InetSocketAddress("p.shifter.io", 443)))
.authenticator(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
"customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600",
"PASSWORD".toCharArray()
);
}
})
.build();
HttpRequest req = HttpRequest.newBuilder(URI.create("https://ipinfo.io/json")).build();
HttpResponse<String> res = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());
}
}

C#

HttpClientHandler.Proxy를 사용하는 HttpClient입니다.

using System.Net;
using System.Net.Http;
var handler = new HttpClientHandler
{
Proxy = new WebProxy("http://p.shifter.io:443")
{
Credentials = new NetworkCredential(
"customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600",
"PASSWORD"
)
},
UseProxy = true
};
using var client = new HttpClient(handler);
var ip = await client.GetStringAsync("https://ipinfo.io/json");
Console.WriteLine(ip);

proxy 요청 옵션을 사용하는 Guzzle입니다.

<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client([
'proxy' => 'customer-USERNAME-country-us-sid-9f3a2b7c-ttl-600:PASSWORD@p.shifter.io:443',
]);
$res = $client->get('https://ipinfo.io/json');
echo $res->getBody();

순수 curl 바인딩(curl_setopt($ch, CURLOPT_PROXY, '...'))도 작동합니다.

이 게이트웨이는 일반적인 HTTP/HTTPS/SOCKS 프록시입니다. 클라이언트가 기본 인증과 함께 이 중 하나를 지원한다면 작동합니다. 제품별 도구(Scrapy, Puppeteer, Playwright, SwitchyOmega, Multilogin)에 대해서는 레지덴셜 프록시 → 통합을 참조하세요.