开发者

how to get file from a passworded area using PHP

开发者 https://www.devze.com 2022-12-22 17:39 出处:网络
I want to make a script that takes a URL to a file and will import that file t开发者_运维问答o a specific folder in my web server

I want to make a script that takes a URL to a file and will import that file t开发者_运维问答o a specific folder in my web server how to request a file if it's in a passworded area, i have an account "username/password" but how can i make the request to that file ?


It depends on the mechanism used to perform the authentication. It might be a formed based system that issues a cookie (in which case you need to make a request to the auth URI and store the returned cookie), it might be HTTP basic authentication (in which case use CURLOPT_USERPWD).


If it is HTTP Authorization you can access it like that:

http://username:password@server.com/folder/myfile.jpg

0

精彩评论

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