Example: file_get_contents()


Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/sperlt/public_html/citw185/examples/content.php on line 13

Warning: file_get_contents(https://sperling.com): Failed to open stream: no suitable wrapper could be found in /home/sperlt/public_html/citw185/examples/content.php on line 13

fopen is not allowed on this host.

 

CODE FOLLOWS

<?php

    
include('includes/header.php');

    echo(
"<h2>Example: file_get_contents() </h2>");

    
ini_set('display_errors'1);

    
$url "https://sperling.com";

 
//   $url = "../doc/mytext.txt";

    
$a file_get_contents($url);

    
$a strip_tags($a);

    echo(
$a);

    
// Output information about allow_url_fopen:
    
if (ini_get('allow_url_fopen') == 1)
        {
        echo 
'<p style="color: #0A0;">fopen is allowed on this host.</p>';
        }
    else
        {
        echo 
'<p style="color: #A00;">fopen is not allowed on this host.</p>';
        }

    include(
'includes/footer.php');
?>