Re: file_get_contents
| From: | Colin Guthrie | Date: | Tue, 06 Feb 2007 13:53:31 +0000 |
| Subject: | Re: file_get_contents | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-248431@lists.php.net to get a copy of this message | ||
Steven Macintyre wrote:
> Hiya,
>
> I need to be able to read a file into a string - I have used the above
> command and it works ... now ... I need to read a file into a string - that
> requires a username and password to access the authentication is normal HTTP
> basic realm
>
> Any ideas?
$var =
file_get_contents('http://username:password@www.example.com/path/to/secret/file.txt');
This is standard web syntax - e.g. it will work in a web browser, wget,
curl, etc.
Col.