note 100594 modified in function.parse-ini-string by danbrown

From: Date: Mon, 25 Oct 2010 21:30:55 +0000
Subject: note 100594 modified in function.parse-ini-string by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173453@lists.php.net to get a copy of this message
Function parse_ini_file doesn't parse a remote ini file if allow_url_include is off. But if allow_url_fopen is on, you can use parse_ini_string to parse a remote ini file after read its contents. <?php /** * Assume that; allow_url_include=0 and allow_url_fopen=1 * (default values in php.ini) */ $iniUrl = 'http://example.com/remote/config.ini'; /** * Warning: parse_ini_file(): http:// wrapper is disabled in the server configuration by allow_url_include=0 */ $config = parse_ini_file($iniUrl); /** * works fine */ $config = parse_ini_string(file_get_contents($iniUrl)); ?> --was-- Function parse_ini_file doesn't parse a remote ini file if allow_url_include is off. But if allow_url_fopen is on, you can use parse_ini_string to parse a remote ini file after read its contents. <?php /** * Assume that; allow_url_include=0 and allow_url_fopen=1 * (default values in php.ini) */ $iniUrl = 'http://computername/remote/config.ini'; /** * Warning: parse_ini_file(): http:// wrapper is disabled in the server configuration by allow_url_include=0 */ $config = parse_ini_file($iniUrl); /** * works fine */ $config = parse_ini_string(file_get_contents($iniUrl)); ?> http://php.net/manual/en/function.parse-ini-string.php

« previous php.notes (#173453) next »