Rápli András Rápli András - 22 days ago 8
PHP Question

allow_url_fopen is on, still can't fetch data

What can I do if I turn on the access but still get php errors?

Warning: file_get_contents() [function.file-get-contents]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in ------------- on line 40

Warning: file_get_contents(http://finance.google.co.uk/finance/info?client=ig&q=NASDAQ:MSFT) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in --------------- on line 40


enter image description here

Answer

try

ini_set("allow_url_fopen", 1);
if (ini_get("allow_url_fopen") == 1) {
echo "allow_url_fopen is ON";
} else {
echo "allow_url_fopen is OFF";
}
print ini_get("allow_url_fopen");  

or you can try a different method

function curl($url){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    $return = curl_exec($ch);
    curl_close ($ch);
    return $return;
}
$string = curl('http://www.example.org/myfile.php'); 

Try to add this code to your .htaccess file:

php_value allow_url_fopen On

if using wamp php.ini are two folders C:\wamp\bin\apache\apacheVersion\bin and C:\wamp\bin\php\phpVersion so make setting allow_url_fopen=on in both files