⚠️ Remember to replace USER, PWD and PORT with your own
package main
import (
"fmt"
"io"
"log"
"net/http"
"net/url"
)
func main() {
proxyURL, err := url.Parse("http://USER:[email protected]:PORT")
if err != nil {
log.Fatalf("Error parsing proxy URL: %v", err)
}
transport := &http.Transport{
Proxy: http.ProxyURL(proxyURL),
}
client := &http.Client{
Transport: transport,
}
resp, err := client.Get("http://httpbin.org/ip")
if err != nil {
log.Fatalf("Error making request: %v", err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatalf("Error reading response: %v", err)
}
fmt.Println(string(body))
}
const axios = require('axios');
const { HttpsProxyAgent } = require('https-proxy-agent');
const proxyUrl = 'http://USER:[email protected]:PORT';
const agent = new HttpsProxyAgent(proxyUrl);
axios.get('http://httpbin.org/ip', {
httpAgent: agent,
httpsAgent: agent,
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
use reqwest::blocking::Client;
use std::error::Error;
fn main() -> Result<(), Box> {
let proxy = reqwest::Proxy::http("http://USER:[email protected]:PORT")?;
let client = Client::builder().proxy(proxy).build()?;
let res = client.get("http://httpbin.org/ip").send()?.text()?;
println!("{}", res);
Ok(())
}
<?php
$proxy = "USER:[email protected]:PORT";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://httpbin.org/ip");
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>