Skip to content
This repository has been archived by the owner on Mar 15, 2020. It is now read-only.

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
padraic committed Mar 8, 2015
1 parent 7841b65 commit 37b4524
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,32 @@ actually the point ;). An error should have two causes:
* The URI requested could not be verified, i.e. in a browser this would be a red page warning.

Neither is, in any way, a justification for disabling SSL/TLS and leaving end users vulnerable
to getting hacked. Resolve such errors; don't ignore or workaround them.
to getting hacked. Resolve such errors; don't ignore or workaround them.

###Headers

You can set request headers, and get response headers, using the following functions.
This support is based around stream contexts, but is offered in some limited form
here as a convenience. If your needs are going to extend this, you should use a
more complete solution and double check that it fully enables and supports TLS.

```php
/**
* Don't end headers with \r\n when setting via array
*/
humbug_set_headers(array(
'Accept-Language: da',
'User-Agent: Humbug'
));
$response = humbug_get_contents('http://www.example.com');
```

Request headers are emptied when used, so you would need to reset on each
`humbug_get_contents()` call.

To retrieve an array of the last response headers:

```php
$response = humbug_get_contents('http://www.example.com');
$headers = humbug_get_headers();
```

0 comments on commit 37b4524

Please sign in to comment.