PHP
Verwenden Sie RaxyProxy von PHP mit cURL oder Guzzle.
cURL-Erweiterung
In allen Standard-PHP-Installationen verfügbar. Keine zusätzlichen Abhängigkeiten.
basic.php
<?php
$ch = curl_init('https://httpbin.org/ip');
curl_setopt_array($ch, [
CURLOPT_PROXY => 'http://proxy.raxyproxy.com:823',
CURLOPT_PROXYUSERPWD => 'USERNAME:PASSWORD',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 15,
CURLOPT_SSL_VERIFYPEER => true,
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
echo $data['origin'] . PHP_EOL;
curl_close($ch);Geo-Targeting
geo.php
<?php
// US only — free, no 2× surcharge
function makeProxy(string $username, string $password): array {
return [
CURLOPT_PROXY => 'http://proxy.raxyproxy.com:823',
CURLOPT_PROXYUSERPWD => "{$username}:{$password}",
];
}
$ch = curl_init('https://httpbin.org/ip');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Country targeting
curl_setopt_array($ch, makeProxy('USERNAME__cr.us', 'PASSWORD'));
$r = json_decode(curl_exec($ch), true);
echo "US IP: " . $r['origin'] . PHP_EOL;
// City targeting (2× billing for residential/mobile/datacenter)
curl_setopt_array($ch, makeProxy('USERNAME__cr.us;city.newyork', 'PASSWORD'));
$r = json_decode(curl_exec($ch), true);
echo "NYC IP: " . $r['origin'] . PHP_EOL;
curl_close($ch);SOCKS5
socks5.php
<?php
$ch = curl_init('https://httpbin.org/ip');
curl_setopt_array($ch, [
CURLOPT_PROXYTYPE => CURLPROXY_SOCKS5_HOSTNAME,
CURLOPT_PROXY => 'proxy.raxyproxy.com:824',
CURLOPT_PROXYUSERPWD => 'USERNAME:PASSWORD',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 15,
]);
$response = curl_exec($ch);
echo json_decode($response, true)['origin'] . PHP_EOL;
curl_close($ch);Guzzle
composer require guzzlehttp/guzzle
guzzle.php
<?php
require 'vendor/autoload.php';
use GuzzleHttpClient;
$client = new Client([
'proxy' => 'http://USERNAME:PASSWORD@proxy.raxyproxy.com:823',
'timeout' => 15,
]);
$response = $client->get('https://httpbin.org/ip');
$data = json_decode($response->getBody(), true);
echo $data['origin'] . PHP_EOL;Parallele Anfragen
guzzle_concurrent.php
<?php
require 'vendor/autoload.php';
use GuzzleHttpClient;
use GuzzleHttpPool;
use GuzzleHttpPsr7Request;
$client = new Client(['proxy' => 'http://USERNAME:PASSWORD@proxy.raxyproxy.com:823']);
$requests = function () {
for ($i = 0; $i < 10; $i++) {
yield new Request('GET', 'https://httpbin.org/ip');
}
};
$pool = new Pool($client, $requests(), [
'concurrency' => 10,
'fulfilled' => function ($response, $index) {
$data = json_decode($response->getBody(), true);
echo "Request {$index}: " . $data['origin'] . PHP_EOL;
},
]);
$pool->promise()->wait();