@@ -4,6 +4,7 @@ Example code for using proxy servers in different programming languages. Current
44
55* Python
66* Ruby
7+ * PHP
78
89## Python Proxy Examples
910
@@ -71,7 +72,76 @@ python python/run_tests.py requests-proxy-headers httpx-proxy-headers
7172
7273## Ruby Proxy Examples
7374
74- * [ requests_proxy.rb] ( ruby/requests_proxy.rb ) - Ruby HTTP with proxy, from [ rpolley] ( https://github.com/rpolley )
75+ ** Installation:**
76+
77+ ``` bash
78+ cd ruby
79+ bundle install
80+ ```
81+
82+ ** Running Examples:**
83+
84+ ``` bash
85+ # Required: Set your proxy URL
86+ export PROXY_URL=' http://user:pass@proxy.example.com:8080'
87+
88+ # Run a single example
89+ ruby ruby/faraday_proxy.rb
90+
91+ # Run all examples as tests
92+ ruby ruby/run_tests.rb
93+ ```
94+
95+ ** Examples:**
96+
97+ | Library | Example | Description |
98+ | ---------| ---------| -------------|
99+ | [ Net::HTTP] ( https://ruby-doc.org/stdlib/libdoc/net/http/rdoc/Net/HTTP.html ) | [ net_http_proxy.rb] ( ruby/net_http_proxy.rb ) | Ruby standard library HTTP client |
100+ | [ Faraday] ( https://lostisland.github.io/faraday/ ) | [ faraday_proxy.rb] ( ruby/faraday_proxy.rb ) | HTTP client with middleware support |
101+ | [ HTTParty] ( https://github.com/jnunemaker/httparty ) | [ httparty_proxy.rb] ( ruby/httparty_proxy.rb ) | Makes HTTP fun again |
102+ | [ RestClient] ( https://github.com/rest-client/rest-client ) | [ rest_client_proxy.rb] ( ruby/rest_client_proxy.rb ) | Simple REST client |
103+ | [ Typhoeus] ( https://typhoeus.github.io/ ) | [ typhoeus_proxy.rb] ( ruby/typhoeus_proxy.rb ) | Fast HTTP client (libcurl wrapper) |
104+ | [ HTTP.rb] ( https://github.com/httprb/http ) | [ http_rb_proxy.rb] ( ruby/http_rb_proxy.rb ) | Simple Ruby DSL for HTTP |
105+ | [ Excon] ( https://github.com/excon/excon ) | [ excon_proxy.rb] ( ruby/excon_proxy.rb ) | Fast, simple HTTP(S) client |
106+ | [ HTTPClient] ( https://github.com/nahi/httpclient ) | [ httpclient_proxy.rb] ( ruby/httpclient_proxy.rb ) | LWP-like HTTP client |
107+ | [ Mechanize] ( https://github.com/sparklemotion/mechanize ) | [ mechanize_proxy.rb] ( ruby/mechanize_proxy.rb ) | Web automation library |
108+
109+ > ** Note:** See [ ruby-proxy-headers] ( https://github.com/proxymeshai/ruby-proxy-headers ) for extensions that add custom proxy header support.
110+
111+ ## PHP Proxy Examples
112+
113+ ** Installation:**
114+
115+ ``` bash
116+ cd php
117+ composer install
118+ ```
119+
120+ ** Running Examples:**
121+
122+ ``` bash
123+ # Required: Set your proxy URL
124+ export PROXY_URL=' http://user:pass@proxy.example.com:8080'
125+
126+ # Run a single example
127+ php php/guzzle_proxy.php
128+
129+ # Run all examples as tests
130+ php php/run_tests.php
131+ ```
132+
133+ ** Examples:**
134+
135+ | Library | Example | Description |
136+ | ---------| ---------| -------------|
137+ | [ cURL] ( https://www.php.net/manual/en/book.curl.php ) | [ curl_proxy.php] ( php/curl_proxy.php ) | PHP's built-in HTTP client (libcurl) |
138+ | [ Guzzle] ( https://docs.guzzlephp.org/ ) | [ guzzle_proxy.php] ( php/guzzle_proxy.php ) | Most popular PHP HTTP client |
139+ | [ Symfony HttpClient] ( https://symfony.com/doc/current/http_client.html ) | [ symfony_http_client_proxy.php] ( php/symfony_http_client_proxy.php ) | Modern PSR-18 HTTP client |
140+ | [ Buzz] ( https://github.com/kriswallsmith/Buzz ) | [ buzz_proxy.php] ( php/buzz_proxy.php ) | Simple PSR-18 HTTP client |
141+ | [ PHP Streams] ( https://www.php.net/manual/en/book.stream.php ) | [ streams_proxy.php] ( php/streams_proxy.php ) | Built-in PHP streams (file_get_contents) |
142+ | [ Amp HTTP] ( https://amphp.org/http-client ) | [ amphp_proxy.php] ( php/amphp_proxy.php ) | Async HTTP client |
143+
144+ > ** Note:** See [ php-proxy-headers] ( https://github.com/proxymeshai/php-proxy-headers ) for extensions that add custom proxy header support.
75145
76146## Documentation
77147
0 commit comments