开发者

PHP Script that'll transfer every request and parameters

开发者 https://www.devze.com 2023-01-23 21:14 出处:网络
I\'m trying to make something kind of fuzzy today :) I\'d like to create some PHP script / .htaccess to execute every request made to the 开发者_运维知识库file (I will redirect every request with .ht

I'm trying to make something kind of fuzzy today :)

I'd like to create some PHP script / .htaccess to execute every request made to the 开发者_运维知识库file (I will redirect every request with .htaccess on my PHP script).

So the script should contact another server with those requests and return the content. My main goal is make it act like a hosts file. I'd send the request with all the parameters, making the other think I'm coming from that very host.

I do this because I can't modify any hosts file on my development server nor on my local workstation. So I'd redirect every request to my development server to my local workstation (on which I installed apache2).

The main questions are: How would you do so? Do you think the php/htaccess combo is okay? How would I identify as the current host to the other server?

I guess it's clear enough :) Any ideas?

Thanks!


As @Marc B says, you are looking to build a Proxy. Due to its nature as an interpreted language, PHP is not the optimal solution for this - using a specialized proxy program / server would be less resource intensive.

That said, if PHP is your only option, there is phpMyProxy that might work for you. I haven't used it myself locally, but the feature list and the demo look pretty impressive.

0

精彩评论

暂无评论...
验证码 换一张
取 消