The request was successful

General explanation of the 200 status code

The HTTP status code 200 OK signals that the server has successfully processed the client's request and returned a correct response. This means that the web page or resource that the client requested was found and successfully transmitted. It is a standard status code used for successful requests.

Specification of the HTTP status code 200

The 200 OK status code indicates that the request has succeeded. The payload sent in a 200 OK response depends on the request method. For the methods defined by this specification, the intended meaning of the payload can be summarized as:

GET a representation of the target resource;

HEAD the same representation as GET, but without the representation data;

POST a representation of the status of, or results obtained from, the action;

PUT, DELETE a representation of the status of the action;

OPTIONS a representation of the communications options;

TRACE a representation of the request message as received by the end server.

Aside from responses to CONNECT, a 200 OK response always has a payload,though an origin server MAY generate a payload body of zero length.If no payload is desired, an origin server ought to send 204 (No Content) instead. For CONNECT, no payload is allowed because the successful result is a tunnel, which begins immediately after the 200 OK response header section. A 200 OK response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls (see Section 4.2.2 of [RFC7234]).

Source / Quote by: The 200 OK HTTP Status Code is specified by section 6.3.1 of RFC7231.

How to throw a 200 statuscode with PHP?

To throw the HTTP status code 200 on a web page, the PHP function http_response_code can be used. The syntax is as follows: http_response_code(200) (PHP 5 >= 5.4.0, PHP 7, PHP 8)

Test the 200 HTTP status code

In order to be able to display the HTTP status code (in this case 200 OK) and other information on the client side, the development console must be opened with F12. Afterwards you have to navigate to the tab "Network". Now you can open the page, in the network tab you should see the web page (example index.php). This must be selected and then the Herder section must be selected. Here the user will see the following result:

Status code 200 OK
URL: https://http-statuscode.com/errorCodeExample.php?code=200
Status: 200 OK
Those: Network
IP address: XX.XX.XX.XX
Status code 200 OK

Browser compatibility of the 200 status code

Chrome Yes
Edge Yes
Firefox Yes
Opera Yes
Safari Yes
Chrome Android Yes
Firefox for Android Yes
Opera Android Yes
Safari on iOS Yes
Internet Yes
WebView Android Yes

Constants in programming languages

$this->response($data, HTTP_OK);

Blog Articles

HTTP status codes 200 OK and 201 Created: successful, but different in meaning

The history of HTTP status codes. The history of HTTP status codes dates back to 1996, when the 200 OK status code came into existence with the introduction of HTTP 1.0. At that time, this code was...

Author: Tony Brüser
Author: Tony Brüser

Tony Brüser is an enthusiastic web developer with a penchant for HTTP status codes.