使用HTTP-Basic身份验证发出HTTP GET请求 [英] Making a HTTP GET request with HTTP-Basic authentication
本文介绍了使用HTTP-Basic身份验证发出HTTP GET请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要为正在处理的Flash Player项目构建代理。我只需要使用HTTP-Basic身份验证向另一个URL发出HTTP GET请求,并从PHP提供响应,就像PHP文件是原始源一样。我怎么能这样做?
I need to build a proxy for a Flash Player project I'm working on. I simply need to make a HTTP GET request with HTTP-Basic authentication to another URL, and serve the response from PHP as if the PHP file was the original source. How can I do this?
推荐答案
使用 file_get_contents()
,带有 stream
指定HTTP凭据,或使用 curl
和 CURLOPT_USERPWD
选项。
Using file_get_contents()
with a stream
to specify the HTTP credentials, or use curl
and the CURLOPT_USERPWD
option.
这篇关于使用HTTP-Basic身份验证发出HTTP GET请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文