I would like to know how I can use PHP to check if the link of download servers like Mega, Google, Filehero among others are active if they are not presenting the result of link offline .
In this case, this is offline , ,
how can I tell if a particular link is off ? programmatically.
I found several codes to validate the existence of pages in the internet, with everything not valid links of servers.
I found this code on the internet, but it does not work properly because even if the link is online the code puts the result as a broken link how can I fix this in this code? Or someone could give me one that works for any download link from mega, 4shared, minhacca etc ...
<?php
$url = 'http://mega.co.nz/#!0Q9zGIwb!v_CAoVPESQ9TExR7H66kA_ZPjjaZCZtBUHZE5_OmcIc';
$result = @file_get_contents($url);
// verifica se a url existe
if ($result !== false):
// procura pelo id do formulário catcha id='captchaform'
$pos = stripos($result, 'captchaform');
// se encontrar o id='captchaform' então é a página dos downloads
if ($pos !== false):
echo 'Url On';
endif;
else:
echo 'Url off!';
endif;
?>