Holbroom Posted March 20, 2014 Share Posted March 20, 2014 <?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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.