How to throw an HTTP request through a Proxy in PHP

Others

I'm Nishimura from Development Department, and I'd like to summarize the result of my research on the requirement of throwing a request through Proxy server in PHP.

code

With the following code, you can get "https://www.ugtop.com/spill.shtml" through the proxy server located at "tcp://123.123.123.123:8080". That's easy!

memo

The default timeout for file_get_contents is 60 seconds, so be careful to specify an appropriate time depending on your requirements. If you expect it to take a long time to respond, you should set it longer, and if you are using it for life and death check, you should set it shorter.

Get started with free compliance training!
banner

  • Comment ( 0 )

  • Trackbacks are closed.

  1. No comments yet.

Related posts