文件名称:PHP代理脚本php-proxy.zip
文件大小:24KB
文件格式:ZIP
更新时间:2022-08-05 00:47:26
开源项目
php-proxy 是基于 PHP,Symfony 和 cURL 的代理脚本,这个库借鉴了 Glype,Jenssegers proxy 和 Guzzle 的经验。示例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(); 标签:phpproxy
【文件预览】:
php-proxy-master
----composer.json(423B)
----LICENSE(1KB)
----src()
--------Redis.php(484B)
--------Config.php(759B)
--------Http()
--------Html.php(5KB)
--------Event()
--------helpers.php(5KB)
--------Plugin()
--------Proxy.php(5KB)
----.gitignore(35B)
----README.md(2KB)