PHP: Is there a way to change request address?

2019-07-04 01:47发布

问题:

For some reason, if I request a file using a url such as this:

http://localhost/proxy.php?url=http://anintranetsite/file.jpg

It works! I can get the file. But if I use,

http://127.0.0.1/proxy.php?url=http://anintranetsite/file.jpg

I cannot get it to work. I am not unnderstanding what is going on... Any thoughts on what could be going wrong?

Thanks

回答1:

Sounds like your browser has the proxy configured wrong.

Aka "No proxy for" should contain localhost AND 127.0.0.1



回答2:

sounds like a router/firewall problem. localhost is probably aliased to your machine name rather than 127.0.0.1