Code Sample

Swiftproxy makes it easy for developers to integrate high-quality residential and static residential proxies into their codebase. Whether you're working with HTTP, HTTPS, or SOCKS5 protocols, our proxies are fully compatible with popular programming languages and tools.

This section provides code-level integration examples across various environments, helping you implement proxy support in real-world use cases such as web scraping, data aggregation, SEO monitoring, and more.

Python

// import requests
if __name__ == '__main__':
proxyip = "http://username_custom_zone_US:[email protected]:7878"
url = "http://ipinfo.io"
proxies = {
'http': proxyip,
}
data = requests.get(url=url, proxies=proxies)
print(data.text)

Node.js

// import fetch from 'node-fetch';
import createHttpsProxyAgent from 'https-proxy-agent'

const username = 'username_custom_zone_us';
const password = 'password';
const proxy = 'us.swiftproxy.net:7878'

const agent = createHttpsProxyAgent(
  `http://${username}:${password}@${proxy}`
);

const response = await fetch('http://ipinfo.io', {
  method: 'get',
  agent: agent,
});

console.log(await response.text());

PHP

GO

Java

C#

Last updated