Reputation: 8369
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
Upvotes: 0
Views: 211
Reputation: 28554
You can use the get_headers function
$headers = @get_headers($url);
$valid = $headers && $headers[0] != 'HTTP/1.1 404 Not Found';
Upvotes: 2