Route outbound HTTP(S) through WeProxy using PHP cURL — the same stack most PHP scrapers, WordPress jobs, and CLI workers already ship with.
- Reads gateway settings from the environment
- Configures
CURLOPT_PROXY+CURLOPT_PROXYUSERPWD - Requests
https://api.ipify.org - Prints the exit IP (or a clear error)
No Composer packages required — only the curl extension.
- PHP 8.0+ with
curlenabled (php -m | findstr curl) - WeProxy user/password from my.we1.town
cp .env.example .envThis minimal sample does not auto-load .env. Export variables in your shell:
export WEPROXY_USER="your-user"
export WEPROXY_PASS="your-pass"
# optional overrides:
# export WEPROXY_HOST=gw.weproxy.com.tr
# export WEPROXY_PORT=8989PowerShell:
$env:WEPROXY_USER="your-user"
$env:WEPROXY_PASS="your-pass"php src/check-ip.php<?php
$ch = curl_init('https://api.ipify.org');
curl_setopt($ch, CURLOPT_PROXY, 'gw.weproxy.com.tr:8989');
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'USER:PASSWORD');
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);Production-ready version with timeouts and exit codes: src/check-ip.php.
| Option | Purpose |
|---|---|
CURLOPT_PROXY |
host:port |
CURLOPT_PROXYUSERPWD |
user:pass |
CURLOPT_PROXYTYPE |
CURLPROXY_HTTP (default here) |
CURLOPT_CONNECTTIMEOUT |
Fail fast on dead gateways |
CURLOPT_TIMEOUT |
Cap total wait |
For SOCKS5 packages, switch CURLOPT_PROXYTYPE to the matching CURLPROXY_SOCKS5 constant only if the panel enables SOCKS for your line.
- Plain PHP / CLI cron — call the script or copy the options into your existing
curl_initflow - Laravel HTTP client — configure a Guzzle handler stack with proxy URL
http://USER:PASS@gw.weproxy.com.tr:8989 - Guzzle directly —
'proxy' => 'http://USER:PASS@gw.weproxy.com.tr:8989'
Product choice (residential vs datacenter) is entirely in the credentials, not in PHP code. See Pricing and Rotating residential.
| Issue | Fix |
|---|---|
curl class missing |
Install php-curl / enable extension |
| Empty body + error string | Print curl_error($ch); check auth |
| SSL complaints to target | Usually unrelated to proxy; verify CA bundle |
| Works in browser tools only | Confirm CLI uses the same env user/pass |
Baseline without PHP:
curl -x http://USER:PASSWORD@gw.weproxy.com.tr:8989 https://api.ipify.orgphp-proxy/
├── assets/banner.png
├── src/check-ip.php
├── .env.example
└── README.md
MIT — see LICENSE.
