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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.