WeProxy
PHP

Language / SDK

WeProxy proxy setup for PHP

The common way to use WeProxy in PHP is cURL. No Composer package is required. Load host, port, and credentials from the environment and verify your 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.

WeProxy connection flow

Requirements

  • PHP 8.0+ with the curl extension (curl should appear in php -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

Other integrations

Looking at another tool?

Get started

Connect with WeProxy now

Create an account, use 100 MB of free residential traffic right away, and follow the steps above in your own setup.