0

I'm trying to validate Google indexed URLs for a given domain in real time to return the valid pages count. I tried using PHP get_headers() and curl method. But even for 50 URLs both methods are taking more than 1 minute.

Is there any other easy method I can use to check whether a URL exists or not? As I have to show the result in real time it should take few seconds only.

Any help would be appreciated. Thanks

Jenz
  • 8,280
  • 7
  • 44
  • 77

1 Answers1

2

You can use the get_headers function

$headers = @get_headers($url);
$valid = $headers && $headers[0] != 'HTTP/1.1 404 Not Found';
LF00
  • 27,015
  • 29
  • 156
  • 295
  • I've already tried get_headers(). But it is too slow. I tried with a domain having 5000 URLs and it was loading for a long time to complete all URLs. I want to get the result in few seconds only – Jenz Jul 09 '20 at 12:29