HTTP Authentication
The HTTP stream wrapper has no context options for HTTP authentication credentials. However, it is possible to include the credentials as part of the URL being accessed. See the example below. Note that credentials are not pre-encoded; this is handled transparently when the request is made. Also, note that this feature only works when Basic HTTP authentication is used; Digest authentication must be handled manually. <?php $response = file_get_contents( 'http://username:password@localhost.example' ); ?> © HTTP Streams Wrapper — Web Scraping >>> Back to TABLE OF CONTENTS <<< | |
Views: 384 | |
Total comments: 0 | |