Need help with php-proxy?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

Athlon1600
232 Stars 112 Forks MIT License 179 Commits 47 Opened issues

Description

A web proxy script written in PHP and built as an alternative to Glype.

Services available

!
?

Need anything else?

Contributors list

# 41,412
PHP
php-pro...
web-pro...
HTML
144 commits
# 184,740
PHP
php-pro...
certifi...
HTML
8 commits
# 536,689
PHP
php-pro...
3 commits
# 393,327
PHP
php-pro...
i18next
Node.js
2 commits
# 210,817
PHP
php-pro...
Less
Linux
1 commit
# 182,022
php-pro...
Shell
stdin
Perl
1 commit
# 636,841
PHP
php-pro...
1 commit
# 322,829
PHP
php-pro...
Twitter
faceboo...
1 commit

php-proxy

Proxy script built on PHP, Symfony and cURL. This library borrows ideas from Glype, Jenssegers proxy, and Guzzle.

PHP-Proxy Web Application

If you're looking for a project version of this script that functions as a Web Application similar to Glype, then visit php-proxy-app

See this php-proxy in action: UnblockVideos.com

Installation

Install it using Composer:

composer require athlon1600/php-proxy

Example

require('vendor/autoload.php');

use Proxy\Http\Request; use Proxy\Proxy;

$request = Request::createFromGlobals();

$proxy = new Proxy();

$proxy->getEventDispatcher()->addListener('request.before_send', function($event){

$event['request']->headers->set('X-Forwarded-For', 'php-proxy');

});

$proxy->getEventDispatcher()->addListener('request.sent', function($event){

if($event['response']->getStatusCode() != 200){
    die("Bad status code!");
}

});

$proxy->getEventDispatcher()->addListener('request.complete', function($event){

$content = $event['response']->getContent();
$content .= '<!-- via php-proxy -->';

$event['response']-&gt;setContent($content);

});

$response = $proxy->forward($request, "http://www.yahoo.com");

// send the response back to the client $response->send();

Plugin Example

namespace Proxy\Plugin;

use Proxy\Plugin\AbstractPlugin; use Proxy\Event\ProxyEvent;

use Proxy\Html;

class MultiSiteMatchPlugin extends AbstractPlugin {

// Matches multiple domain names (abc.com, abc.de, abc.pl) using regex (you MUST use / character)
protected $url_pattern = '/^abc\.(com|de|pl)$/is';
// Matches a single domain name
//protected $url_pattern = 'abc.com';

public function onCompleted(ProxyEvent $event){

    $response = $event['response'];

    $html = $response-&gt;getContent();

    // do your stuff here...

    $response-&gt;setContent($html);
}

}

Notice that you must use the / character for regexes on

$url_pattern

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.