URL Exist or Not Exist Check PHP

Posted By TimesCoding Staff | June 9, 2022 | PHP

We can easily check a given URL or Link is active or not. By using below PHP function we can easily get whether the given URL is active or not active.

<?php

$url='https://timescoding.com/';

$array = get_headers($url);
$string = $array[0];
if(strpos($string,"200"))
  {
    echo 'URL Exist';
  }
  else
  {
    echo 'URL does not exist';
  }



Author: TimesCoding Staff

TimesCoding Staff is a member of the team, and an expert in HTML, CSS, JavaScript, PHP, Ajax, and WordPress theme development.

Read Next