file_get_contents

Gestart doorMilan2 reacties35 weergaven

3 berichten · pagina 1 van 1

Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoi,

Omdat ik dus geen ervaring met file_get_contents heb.. Vraag ik het maar hier..
Ik heb nu dit dus:

[COLOR= #0000BB]<?php[/COLOR]

[COLOR= #FF8000]/**
 * @author Milan Drossaerts
 * @for Bob Maas
 * @page check.php
 * @copyright 2009
 */[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR][COLOR= #FF8000]//Ik weet niet waar je database connectie staat, maar ik ga uit van config.php[/COLOR]
[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT tabbellen FROM kolom"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR][COLOR= #FF8000]//De query om te selecteren[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])[/COLOR][COLOR= #FF8000]//Net zovaak herhalen als er in de database staat[/COLOR]
[COLOR= #007700]{[/COLOR][COLOR= #FF8000]//Loop beginnen[/COLOR]
    [COLOR= #0000BB]$fetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR][COLOR= #FF8000]//Zorgen dat gegevens kunnen worden weergeven[/COLOR]
    [COLOR= #0000BB]$ophalen[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR][COLOR= #FF8000]//Kijken of de opgegeven website content bevat[/COLOR]
[COLOR= #007700]}[/COLOR][COLOR= #FF8000]//Loop beeindigen[/COLOR]


?>


Hoe zorg ik ervoor dat als de website niet bereikbaar is, dat hij dan notonline.php include, en als hij wel bereikbaar is goonline.php included?

#Milan
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Zoiets?

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]/**
 * @author Milan Drossaerts
 * @for Bob Maas
 * @page check.php
 * @copyright 2009
 */[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR][COLOR= #FF8000]//Ik weet niet waar je database connectie staat, maar ik ga uit van config.php[/COLOR]

[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT tabbellen FROM kolom"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR][COLOR= #FF8000]//De query om te selecteren[/COLOR]

[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]))
{[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](@[/COLOR][URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url[/COLOR][COLOR= #007700]]))
    {[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]goonline.php[/COLOR][COLOR= #007700]);
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]notonline.php[/COLOR][COLOR= #007700]);
    }
    
    
    
}[/COLOR]


?>
0
Milan

Lid · Topicstarter

Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hartelijk bedankt Rik!
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren