code.progysm.com

file_get_contents

Description
	Récupérer le contenu d'un fichier ou d'une ressource externe (URL).

Syntaxe:
	string|boolean false file_get_contents(string $filename, boolean $use_include_path = false, resource $context = null, ...)

Paramètres:
	string $filename : nom du fichier ou URL externe
	boolean $use_include_path
	resource $context : resource retournée par stream_context_create

Exemples:
	$content = file_get_contents('file.txt');
	$content = file_get_contents('http://test.com/test.txt');

	Avec un timeout de une seconde (en HTTP):
		$ctx = stream_context_create(array(
		     'http' => array(
		       'timeout' => 1
		    )
		  )
		);
		file_get_contents("http://test.com/test.txt", false, $ctx);

Avertissement:
	Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error
	Warning: Failed to open $filename (Could not resolve host: $host)


Note:
	On peut avoir la liste des entêtes dans la variable $http_response_header

Voir aussi:
	stream_context_create(array)
	www.php.net/manual/fr/function.file-get-contents.php#82527
	www.php.net/manual/fr/function.file-get-contents.php#74551