-
PHP代理脚本php-proxy.zip下载
资源介绍
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
- 上一篇: 安卓手机换ip软件全国300+城市
- 下一篇: SetL2TP.exe