2
I wonder how I can use PHP to check if the link of download of servers such as Mega, Google, Filehero and others are active if they are not presenting the result of offline link.
In this case URL this offline, how can I know if a certain link is off? programmatically.
I found several codes to validate the existence of pages on the internet, with everything not valid links server.
I found this code on the internet, but it doesn’t work properly because even if the link is online the code puts the result as a broken link how can I fix it in this code ? Or someone could pass me one that works for any mega download link, 4shared, Minhateca 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;
?>
Have you read about the API of Mega?
– Erlon Charles
http://julien-marchand.fr/blog/using-the-mega-api-with-php-examples/
– Erlon Charles
more ai only check in case the mega need to check any link.
– Striffer
Then this question can solve your problem, http://answall.com/questions/1819/howto checkout se-uma-imagem-existe-num-url-remote
– Erlon Charles
send me a valid url
– Ricardo
As I’m a bit busy at the moment, I’ll stop by, try to take a look here https://github.com/codeguy/modern-php/tree/master/04-components/url-scanner-component that should help you, later, if possible, I’ll try to give you a better answer with this! In short, it is an example of the book, which checks whether the url is valid or not!
– Marcelo Diniz
I gave an update on the question.
– Striffer
@Rodrigo That code I posted only checks if the answer code indicates if the request was successful, I tested here only with Mega, and it seemed to work. However, if you intend to check links of a wider range of Servers, use http://urlchecker.org/ there is even an API.
– stderr
Okay thanks for the help.
– Striffer