-
Notifications
You must be signed in to change notification settings - Fork 1
/
php-example.php
34 lines (27 loc) · 923 Bytes
/
php-example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
// Get proxy credentials from environment variables
$proxyUsername = getenv('proxy_username');
$proxyPassword = getenv('proxy_password');
if (!$proxyUsername || !$proxyPassword) {
echo "Error: Proxy credentials not set. Please set proxy_username and proxy_password.\n";
echo "Example:\n";
echo "export proxy_username=your_username\n";
echo "export proxy_password=your_password\n";
exit(1);
}
// Initialize cURL session
$ch = curl_init();
// Set cURL options
curl_setopt($ch, CURLOPT_URL, "https://ip.evomi.com/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, "rp.evomi.com:1000");
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "customer-$proxyUsername:$proxyPassword");
// Execute cURL request
$response = curl_exec($ch);
if ($response === false) {
echo "cURL Error: " . curl_error($ch);
} else {
echo $response;
}
// Close cURL session
curl_close($ch);