Ngôn ngữ / SDK
Thiết Lập Proxy WeProxy Cho PHP
Cách phổ biến để dùng WeProxy trong PHP là cURL. Không cần gói Composer. Tải host, port và thông tin đăng nhập từ môi trường rồi xác minh exit IP.
The most common way to use WeProxy in PHP is cURL. No Composer package is required — only the curl extension. This short guide shows how to verify your exit IP through an HTTP proxy with host, port, and credentials.
Requirements
- PHP 8.0+ with the
curlextension (curlshould appear inphp -m) - Host, port, username, and password from the WeProxy panel
Do not hard-code credentials. Keep them in environment variables.
export WEPROXY_HOST="gw.weproxy.com.tr"
export WEPROXY_PORT="8989"
export WEPROXY_USER="PROXY_USERNAME"
export WEPROXY_PASSWORD="PROXY_PASSWORD"
HTTP Proxy with cURL
<?php
$host = getenv('WEPROXY_HOST') ?: 'gw.weproxy.com.tr';
$port = getenv('WEPROXY_PORT') ?: '8989';
$user = getenv('WEPROXY_USER') ?: '';
$pass = getenv('WEPROXY_PASSWORD') ?: '';
$ch = curl_init('https://api.ipify.org');
curl_setopt($ch, CURLOPT_PROXY, $host . ':' . $port);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $user . ':' . $pass);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
echo curl_exec($ch);
If your package supports SOCKS5 and the panel enables it, set CURLOPT_PROXYTYPE to CURLPROXY_SOCKS5.
GitHub example
See the runnable sample, env setup, and short README in weproxy-io/php-proxy.
Sources
Tích hợp khác
Đang xem công cụ khác?
Bắt Đầu
Kết nối với WeProxy ngay
Tạo tài khoản, dùng ngay 100 MB traffic residential miễn phí và làm theo các bước ở trên trong thiết lập của bạn.










