Athlon1600 / php-proxy-app

Web Proxy Application built on php-proxy library ready to be installed on your server
https://www.php-proxy.com/
MIT License
824 stars 518 forks source link

how to call php-proxy using other php code? #133

Open Medow opened 5 years ago

Medow commented 5 years ago

I have a running website and i need to use php-proxy to hide some part of that website.

I need to disable direct login to php-proxy main index page for every one.

I just need to call the proxy within my website only.

for example

if i have this link in my code

http://somedomain.com/file.zip

I need to call that file through the proxy like this

http://myproxydomain.com/index.php?q=mdan1aRvkmHb2K1mnNGnypzKY5efnpKrlpemmKE

I use option 3 for url method.

how to generate the encoded url for the orginal url on the fly for each user on the fly?

Thanks.

Benji-Collins commented 5 years ago

You could try changing the php-proxy script so it takes a variable as the search item, then send the request for the file to the php-script as a variable each time you need it. Obviously the proxy would have to be set to different URLs for each request, otherwise you would just have a static link.

Medow commented 5 years ago

I edit the index.php like this ` $encrypturl = $_GET['q']; $encrypturl = add_http($encrypturl); $encrypturl = htmlspecialchars_decode ($encrypturl); $base_url = ''; $base_url = add_http($base_url); $encrypturl = rel2abs($encrypturl, $base_url); $encrypturl = url_encrypt($encrypturl); // decode q parameter to get the real URL $url = url_decrypt($encrypturl);

$proxy = new Proxy(); `

Then i test it browsing this page

example.com/index.php?q=youtube.com

it redirect to example.com/index.php?q=mdan1aRvkmHd0KusqsSdkZPUomM

But it show index.php page with error (6) Could not resolve host: mdan1aRvkmHd0KusqsSdkZPUomM