Skip to content

Commit 28bb757

Browse files
committed
Fix php-curl-class#554: Add example for making a request through a SOCKS 5 proxy
1 parent c2f47ca commit 28bb757

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

examples/proxy_socks5.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
require __DIR__ . '/../vendor/autoload.php';
3+
4+
use \Curl\Curl;
5+
6+
// If needed, start a SOCKS 5 proxy tunnel:
7+
// $ ssh -D 8080 -C -N -v user@example.com
8+
9+
$curl = new Curl();
10+
$curl->setProxy('127.0.0.1:8080');
11+
$curl->setProxyType(CURLPROXY_SOCKS5);
12+
$curl->get('https://httpbin.org/ip');
13+
var_dump($curl->response);

0 commit comments

Comments
 (0)