Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by Pekka for PHP XML disable feed if offline

You can use file_get_contents() and define the timeout using a stream context as explained here:Does file_get_contents() have a timeout setting?

Modified code from the answer there:

<?php$ctx=stream_context_create(array('http'=>    array('timeout' => 5 // 5 seconds    )));echo file_get_contents('http://example.com/',false,$ctx);?>

Viewing latest article 1
Browse Latest Browse All 2

Trending Articles