Inside this article we will see the concept i.e PHP How To Find HTTP Status code of any website. Article contains the classified information about Finding HTTP Status code of any website in PHP. There are several HTTP status code depends on the response of the website hosted server.
An HTTP status code is a server response to a browser’s request. When you visit a website, your browser sends a request to the site’s server, and the server then responds to the browser’s request with a three-digit code: the HTTP status code.
HTTP Status codes are – 200, 403, 404, 500, etc.
Learn More –
- PHP How To Install SSL on Subdomain via cPanel API
- PHP MySQLi Form Validation Using jQuery Tutorial
- How To Use Bootstrap Tag Manager jQuery Plugin Tutorial
- How To Convert Speech To Text In jQuery / Javascript
Let’s get started.
Application Programming
Create a file named as index.php. Write this code into it.
<?php function get_response_code($url) { @file_get_contents($url); list($version, $status, $text) = explode(' ', $http_response_header[0], 3); return $status; } echo get_response_code('https://www.yourwebsite.com/');
According to the response of website’s hosted server, we have these status codes –
We hope this article helped you to learn PHP How To Find HTTP Status Code of Any Website Tutorial in a very detailed way.
Online Web Tutor invites you to try Skillshike! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.
If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.