★ wanayoo — archive 1999 http://www.php.net/manual/fr/function.readfile.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Système de fichiers
Quick Reference
English version of this pageGerman version of this pageJapanese version of this pageItalian version of this pageHungarian version of this page
Système de fichiers
* basename
* chgrp
* chmod
* chown
* clearstatcache
* copy
* delete
* dirname
* diskfreespace
* fclose
* feof
* fgetc
* fgetcsv
* fgets
* fgetss
* file
* file_exists
* fileatime
* filectime
* filegroup
* fileinode
* filemtime
* fileowner
* fileperms
* filesize
* filetype
* flock
* fopen
* fpassthru
* fputs
* fread
* fseek
* ftell
* fwrite
* set_file_buffer
* is_dir
* is_executable
* is_file
* is_link
* is_readable
* is_writeable
* link
* linkinfo
* mkdir
* pclose
* popen
* readfile
* readlink
* rename
* rewind
* rmdir
* stat
* lstat
* symlink
* tempnam
* touch
* umask
* unlink
Manual: readfile
View the source code for this pageSearch the site



Previous page
 popen
 Updated
Sun, 06 Aug 2000
readlink 
Next page


readfile

(PHP3 , PHP4 )

readfile -- Affiche un fichier.

Description

int readfile (string filename [, int use_include_path])

readfile() lis le fichier filename et l'envoi à la sortie standard.

Retourne le nombre d'octets lus depuis le fichier. Si une erreur survient, retourne FALSE.

Si filename commence par "http://" (insensible à la casse), une connexion HTTP 1.0 sera ouverte avec le serveur spécifié, et le texte de la réponse sera affiché sur la sortie standard.

ATTENTION : PHP ne gère pas les redirections, donc il faut penser à ajouter un "/" final pour les dossiers.

Si filename commence par "ftp://" (insensible à la casse), une connexion FTP est ouverte avec l'hôte spécifié et la réponse du serveur est affichée. Si le serveur ne supporte les connexions passives, la requête échouera.

Si filename ne commence par aucun des cas précédents, le fichier sera ouvert sur l'hôte local, et envoyé à la sortie standard.

Vous pouvez utiliser le deuxième paramètre optionnel pour explorer le dossier include_path, en passant la valeur de 1.

Voir aussi fpassthru(), file(), fopen(), include(), require(), et virtual().


User Contributed Notes: readfile


jurrit@home.nl
08-Mar-2000 08:49
This is actually more a question, but I will ask it any way.
I made a php3 script that pulls data from a MySQL database and puts it on the screen. Is it possible, to save what is on the screen, to a text file? Now I just click on the browsers save as.. function. But I want to automate this procedure.

Thanx in advance.

Jurrit



robert@abilina.org
15-Mar-2000 11:21
If you are using this function to read a remote server's page and the URL requires a cookie, there appears to be no way to read it using this function. It would be very nice if this were supported.


jason@familynet.net
15-May-2000 10:39
If you use readfile() to pull down HTML from an http:// source, is there a way to handle connection timeouts? For example, if the http server we are attempting to read from is down, how do you it it up to do something else (or even display an error)?


hicking@du.gtn.com
22-May-2000 09:21
You might want to try checking the $php_errormsg variable after calling readfile(...). To supress errormessages to your client's browser you could also add @ before readfile(...). Make sure you have track_errors enabled in your php configuration. See <A HREF=/old?u=http%3A%2F%2Fwww.php.net%2Fmanual%2Flanguage.operators.errorcontrol.php%26gt%3BError&y=1999 Control</A> in the manual.


 About Notes


Previous page
 popen
 Updated
Sun, 06 Aug 2000
readlink 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.