PHP code for POST JSON String Basic Authentication ExampleThis PHP code snippet was generated automatically for the POST JSON String Basic Authentication example.
<< Back to the POST JSON String Basic Authentication example
What is HTTP?
Hypertext Transfer Protocol is a data transfer protocol that is widely used to transfer data between HTTP clients (browsers and mobile apps) and servers. HTTP is based on "client-server" technology. The client makes a request and initiates a connection, and the server receives the request and then executes it and sends the result to the client. HTTP defines various request methods that indicate the desired action (add, update, delete) for a given resource. Each request method implements its semantics and performs a specific action.
What is HTTP Authentication?
HTTP Authentication is a simple request and response method by which a server can request authentication information from a client and provide a framework for controlling access to resources. Authentication is a consequence of determining whether a client has the right to access a resource. HTTP supports authentication as a means of negotiating access to a protected resource.
What is Basic Authentication?
Basic Authentication is a simple authentication method built into the HTTP protocol. The Basic Authentication sends the base64 encoded string with the username and password in the Authorization header. Basic Authentication should only use in conjunction with other security mechanisms such as HTTPS/SSL for security reasons. To send basic authentication credentials to the server, you need to convert the "username: password" pair to a Base64 encoded string and pass it in the authorization request header.
Basic Authentication Syntax
The following is the common syntax for Basic Authentication header:
- Authorization: standard HTTP authorization header
- Basic: indicates HTTP Authorization type
What is JSON?
What is POST request?
HTTP POST is one of the most commonly used HTTP methods. The POST request may or may not contain data. The POST requests are usually used when submitting web forms or when uploading files to a server. The POST data is included in the body of the POST message. The Content-Type header indicates the type of the POST request body, and the length is specified in the Content-Length header.