note 69819 added to function.file
| From: | robrohan at gmail dot com | Date: | Fri, 22 Sep 2006 05:17:05 +0000 |
| Subject: | note 69819 added to function.file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117408@lists.php.net to get a copy of this message | ||
There is nothing on there that shows how to just do a simple basic authentication type request. You
use 'user@password' in the url itself. For example:
<?php
// Get a file into an array. In this example we'll go through HTTP to get
// the HTML source of a URL.
$lines = file('http://user:password@example.com/client/atom.xml');
// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) .
"<br />\n";
}
// Another example, let's get a web page into a string. See also file_get_contents().
$html = implode('', file('http://www.example.com/'));
?>
----
Server IP: 66.163.161.117
Probable Submitter: 71.146.184.214
----
Manual Page -- http://www.php.net/manual/en/function.file.php
Edit -- https://master.php.net/note/edit/69819
Del: integrated -- https://master.php.net/note/delete/69819/integrated
Del: useless -- https://master.php.net/note/delete/69819/useless
Del: bad code -- https://master.php.net/note/delete/69819/bad+code
Del: spam -- https://master.php.net/note/delete/69819/spam
Del: non-english -- https://master.php.net/note/delete/69819/non-english
Del: in docs -- https://master.php.net/note/delete/69819/in+docs
Del: other reasons-- https://master.php.net/note/delete/69819
Reject -- https://master.php.net/note/reject/69819
Search -- https://master.php.net/manage/user-notes.php