note 72317 added to function.stream-context-create
| From: | php at charlesconsulting dot com | Date: | Sat, 13 Jan 2007 15:14:12 +0000 |
| Subject: | note 72317 added to function.stream-context-create | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-121596@lists.php.net to get a copy of this message | ||
Here's an example of retrieving a page which requests a username and password using the basic
authorization scheme. This calls the w3.org web page validator for a password protected page.
//$fileurl contains page to validate
$validateurl="http://validator.w3.org/check?uri=$fileurl";
$cred = sprintf('Authorization: Basic %s',
base64_encode('username:password') );
$opts = array(
'http'=>array(
'method'=>'GET',
'header'=>$cred)
);
$ctx = stream_context_create($opts);
$validate=file_get_contents($validateurl,false,$ctx);
----
Server IP: 64.71.164.2
Probable Submitter: 65.113.125.145
----
Manual Page -- http://www.php.net/manual/en/function.stream-context-create.php
Edit -- https://master.php.net/note/edit/72317
Del: integrated -- https://master.php.net/note/delete/72317/integrated
Del: useless -- https://master.php.net/note/delete/72317/useless
Del: bad code -- https://master.php.net/note/delete/72317/bad+code
Del: spam -- https://master.php.net/note/delete/72317/spam
Del: non-english -- https://master.php.net/note/delete/72317/non-english
Del: in docs -- https://master.php.net/note/delete/72317/in+docs
Del: other reasons-- https://master.php.net/note/delete/72317
Reject -- https://master.php.net/note/reject/72317
Search -- https://master.php.net/manage/user-notes.php