Jump to content

Help to modify my code.


Holbroom

Recommended Posts


<?php 

$url = "http://172.31.244.170/~espresso/primary_uk/index.html"; 
$page = fopen($url, 'r'); 
$content = ""; 
while( !feof( $page ) ) { 
$buffer = trim( fgets( $page, 4096 ) ); 
$content .= $buffer; 
} 
  

$start = "Last updated: "; 
$end = "<\/footer>"; 
  

preg_match( "/$start(.*)$end/s", $content, $match); 
$mytext = $match[1]; 
echo "$mytext"; 
?>

Would somebody kindly modify the code I have above to return an "Offline message" if the URL times out (PC is offline or not connected), Many Thanks :)

 

Link to comment
https://forums.phpfreaks.com/topic/287114-help-to-modify-my-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.