dousuowu4610 2013-07-29 15:06
浏览 463
已采纳

allow_url_fopen打开,仍然无法获取数据

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

  • 写回答

1条回答 默认 最新

  • dtn36013 2013-07-29 15:11
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止