• Stars
    star
    293
  • Rank 141,306 (Top 3 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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: proxy.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']->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->getContent();
		
		// do your stuff here...
		
		$response->setContent($html);
	}
}

Notice that you must use the / character for regexes on $url_pattern

More Repositories

1

php-proxy-app

Web Proxy Application built on php-proxy library ready to be installed on your server
PHP
816
star
2

youtube-downloader

📺 PHP based alternative to youtube-dl and yt-dlp. Active and frequently updated! ⭐
PHP
776
star
3

notepad

📄 Web-based application for storing notes securely. Built with Vue + Node.js + Express
JavaScript
128
star
4

SerpScraper

🔎 Google/Bing search results scraping using PHP. Tested and working / May 13, 2020
PHP
89
star
5

win32gui

A tiny, header-only, Win32 API wrapper library that assists in building native GUI components for Windows platform.
C++
42
star
6

php-curl-file-downloader

⭐ Download large files using PHP and cURL
PHP
23
star
7

nginx-rtmp-server

📺 Build your own video streaming site using nginx-rtmp module.
TypeScript
20
star
8

php-proxy-plugin-bundle

PHP-Proxy Plugins made for unblockvideos.com
PHP
19
star
9

php-proxy-installer

Install PHP-Proxy app on your server with a one-line command
Shell
16
star
10

php-curl-client

A very simple curl client - less than 100 lines. Perfect for being a base class.
PHP
13
star
11

useful

👍 Useful shell scripts in one place
Shell
8
star
12

chat

💬 Chat application written in TypeScript with a Vue frontend
TypeScript
7
star
13

php-proxy-plugin-cache

Provides caching support for PHP-Proxy application
PHP
6
star
14

php-cookie-parser

🍪 Convert between various cookie formats
PHP
6
star
15

php-proxy-headers

PHP-based proxy judge script in a single file
PHP
5
star
16

vnstat-php

📊 Super simple status page for vnstat using PHP.
PHP
5
star
17

azenv

AZ Environment variables 1.04
PHP
4
star
18

ie_proxy

A tiny C++ library that makes it easy to change proxy settings
C++
4
star
19

php-captcha-solver

solve captchas using 2captcha.com
PHP
4
star
20

vnstat-limit

Automatically manage and limit your bandwidth consumption to avoid overcharges
Shell
3
star
21

http_request

A simple, header-only C++ library for making HTTP requests
C++
2
star
22

country.proxynova.com

Super simple Web Service used to determine client's country of origin.
1
star