PHP Classes

PHP Proxy Server: Forward HTTP requests to destination servers

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 44%Total: 438 All time: 6,267 This week: 73Up
Version License PHP version Categories
proxy-server 1.1The PHP License5.0Networking, HTTP, PHP 5
Description 

Author

This class can forward HTTP requests to destination servers.

It listens to connections on a given TCP port and forwards HTTP requests to final servers and return the responses.

The class uses Guzzle to forward requests to the destination HTTP servers.

The server host and an port that the proxy server lists are configurable.

Innovation Award
PHP Programming Innovation award winner
January 2016
Winner


Prize: One downloadable copy of Komodo IDE
HTTP proxy servers are useful to provide anonymity to users or computers that want to access remote Web servers.

This class implements a proxy for HTTP requests using pure PHP code.

Manuel Lemos
Picture of Yousaf Syed
  Performance   Level  
Name: Yousaf Syed <contact>
Classes: 6 packages by
Country: Pakistan Pakistan
Age: 33
All time rank: 232530 in Pakistan Pakistan
Week rank: 43 Up1 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Documentation

standalone_php_proxy

Standalone proxy server in PHP sockets, I am using Guzzle to route the requests. Idea was if I can make HTTP Proxy Server in php to get more control over proxy and custom logic. Currently it only supports http requests you can choose port of your own choice plus if you want to make it public or private. This is a standard HTTP Proxy so you can use in browser. By default its only working for localhost, but you can allow public ip's.

Todo

  1. ~~Package availble via composer~~
  2. Easy way to integrate custom Logic
  3. Support HTTPs
  4. ~~Parse FormData~~

How To Install?

Define package in your composer.json file as require dependency

   "require": {
        "yousafsyed/standalone_php_proxy": "^v1.0"
    }

Now update/install composer dependencies

   $ composer install
   $ composer update

Example

Create a file server.php

   require "./vendor/autoload.php";
   use YousafSyed\ProxyServer;
   $server = new ProxyServer(); // optional parameters for port and host like this new ProxyServer('8080','localhost')
   // finally run the server
   $server->run();

How to Run?

$ php server.php

ScreenShot

ScreenShot


  Files folder image Files (5)  
File Role Description
Files folder imagesrc (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (5)  /  src  
File Role Description
Files folder imageYousafSyed (1 file)

  Files folder image Files (5)  /  src  /  YousafSyed  
File Role Description
  Plain text file ProxyServer.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:438
This week:0
All time:6,267
This week:73Up
User Ratings User Comments (2)
 All time
Utility:66%StarStarStarStar
Consistency:58%StarStarStar
Documentation:58%StarStarStar
Examples:-
Tests:-
Videos:-
Overall:44%StarStarStar
Rank:3430
 
very useful it helped me alot with my latest assignment
8 years ago (Syed Usman Ali)
70%StarStarStarStar
Good.
8 years ago (Hassan Raza)
70%StarStarStarStar