简体   繁体   中英

Is it possible to do a GET/POST request on a website with basic HTTP authentication?

I need to do a GET request on a website that is protected by basic HTTP authentication on my local network. Is it possible to authenticate with the GET request?

If yes, how can I do that?

I'm using PHP.

Yes, it is possible. You can provide the username and password directly in the URL in the following form:

<form method="get" action="http://username:password@yoursite.com/blah/script.php">

Whether it is a good idea to do this or not is another story. I would highly discourage it in a production environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM