Contoh kode
Salin, ganti user dan sandinya, jalan.
Salin, ganti nama pengguna dan sandinya, jalan. Semua contoh memakai port ganti-ganti.
curl
curl -x http://gt-8f21c4:PASSWORD@proxy.growtechcentral.com:823 https://api.ipify.org
Python
import requests
p = "http://gt-8f21c4:[email protected]:823"
r = requests.get("https://api.ipify.org", proxies={"http": p, "https": p})
print(r.text)
Node.js
import { HttpsProxyAgent } from "https-proxy-agent";
const agent = new HttpsProxyAgent("http://gt-8f21c4:[email protected]:823");
const r = await fetch("https://api.ipify.org", { agent });
console.log(await r.text());
PHP
$ch = curl_init("https://api.ipify.org");
curl_setopt($ch, CURLOPT_PROXY, "http://proxy.growtechcentral.com:823");
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "gt-8f21c4:PASSWORD");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
Dengan penargetan
Penargetan ditambahkan ke nama penggunanya, bukan ke alamat:
curl -x http://gt-8f21c4__cr.id:PASSWORD@proxy.growtechcentral.com:823 https://api.ipify.org