Use the context (via stream_context_create ) and the context ignore_errors option that "Get content even by failure status codes" .:
$options = array( 'http' => array( 'ignore_errors' => true, ), ); $context = stream_context_create($options); $handle = fopen('http://url/', 'r', false, $context);
source share