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

Commit

Permalink
[Docs] Fixes #37 - Check All Headers In Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
froschdesign committed Feb 18, 2016
1 parent f0786f9 commit ebf426e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 29 deletions.
18 changes: 9 additions & 9 deletions doc/book/zend.http.client.adapters.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ the server you are connecting to requires special client setup. If so, you shoul
about *SSL* transport layers and options
[here](http://www.php.net/manual/en/transports.php#transports.inet).

**Changing the HTTPS transport layer**
### Changing the HTTPS transport layer

```php
// Set the configuration parameters
Expand Down Expand Up @@ -88,7 +88,7 @@ Providing an array will create a new stream context using these options, and set
create a default stream context and return it. You can then set or get the value of different
context options using regular *PHP* stream context functions.

**Setting stream context options for the Socket adapter**
#### Setting stream context options for the Socket adapter

```php
// Array of options
Expand Down Expand Up @@ -160,7 +160,7 @@ require authentication, you can leave these two options out.
Possibly values are similar to the ones accepted by the `Zend\Http\Client::setAuth()` method.
Currently, only basic authentication (`Zend\Http\Client::AUTH_BASIC`) is supported.

**Using Zend\\Http\\Client behind a proxy server**
### Using Zend\\Http\\Client behind a proxy server

```php
// Set the configuration parameters
Expand Down Expand Up @@ -195,7 +195,7 @@ for a *HTTP* client and make it a perfect choice for a *HTTP* adapter. It suppor
connections, proxy, all sorts of authentication mechanisms and shines in applications that move
large files around between servers.

**Setting cURL options**
### Setting cURL options

```php
$config = array(
Expand All @@ -211,7 +211,7 @@ cURL options by either specifying the 'curloptions' key in the constructor of th
calling `setCurlOption($name, $value)`. The `$name` key corresponds to the CURL\_\* constants of the
cURL extension. You can get access to the Curl handle by calling `$adapter->getHandle();`

**Transfering Files by Handle**
### Transfering Files by Handle

You can use cURL to transfer very large files over *HTTP* by filehandle.

Expand Down Expand Up @@ -248,7 +248,7 @@ method takes one parameter, which represents an *HTTP* response as either text o
`Zend\Http\Response` object. Once set, your Test adapter will always return this response, without
even performing an actual *HTTP* request.

**Testing Against a Single HTTP Response Stub**
### Testing Against a Single HTTP Response Stub

```php
// Instantiate a new adapter and client
Expand Down Expand Up @@ -285,7 +285,7 @@ Sometimes, a single method call to an object can result in that object performin
transactions. In this case, it's not possible to use setResponse() alone because there's no
opportunity to set the next response(s) your program might need before returning to the caller.

**Testing Against Multiple HTTP Response Stubs**
### Testing Against Multiple HTTP Response Stubs

```php
// Instantiate a new adapter and client
Expand Down Expand Up @@ -340,7 +340,7 @@ will cause the next call to `connect()` to throw an
application caches content from an external site (in case the site goes down) and you want to test
this feature.

**Forcing the adapter to fail**
### Forcing the adapter to fail

```php
// Instantiate a new adapter and client
Expand Down Expand Up @@ -374,7 +374,7 @@ In order to do so, you must create your own adapter class that implements the
user-implemented adapter class. All the public functions defined in this example must be defined in
your adapter as well:

**Creating your own connection adapter**
### Creating your own connection adapter

```php
class MyApp\Http\Client\Adapter\BananaProtocol
Expand Down
23 changes: 12 additions & 11 deletions doc/book/zend.http.client.advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ clients to not implement this and always use a `GET` request when redirecting. B
parameters are reset, and a `GET` request is sent to the new location. This behavior can be changed
by setting the `strictredirects` configuration parameter to boolean `TRUE`:

**Forcing RFC 2616 Strict Redirections on 301 and 302 Responses**
### Forcing RFC 2616 Strict Redirections on 301 and 302 Responses

```php
// Strict Redirections
Expand All @@ -31,7 +31,7 @@ You can always get the number of redirections done after sending a request using
header modification is required. Cookies can be added using either the addCookie() or `setCookies`
method. The `addCookie` method has a number of operating modes:

**Setting Cookies Using addCookie()**
### Setting Cookies Using addCookie()

```php
// Easy and simple: by providing a cookie name and cookie value
Expand All @@ -53,7 +53,7 @@ $client->addCookie($cookies);
The `setCookies()` method works in a similar manner, except that it requires an array of cookie
values as its only argument and also clears the cookie container before adding the new cookies:

**Setting Cookies Using setCookies()**
### Setting Cookies Using setCookies()

```php
// setCookies accepts an array of cookie values as $name => $value
Expand All @@ -71,7 +71,7 @@ client internally store all sent and received cookies, and resend them on subseq
`Zend\Http\Cookies`. This is useful, for example when you need to log in to a remote site first and
receive and authentication or session ID cookie before sending further requests.

**Enabling Cookie Stickiness**
### Enabling Cookie Stickiness

```php
$headers = $client->getRequest()->getHeaders();
Expand Down Expand Up @@ -100,7 +100,7 @@ Setting custom headers is performed by first fetching the header container from
`Zend\Http\Request` object. This method is quite diverse and can be used in several ways, as the
following example shows:

**Setting A Single Custom Request Header**
### Setting A Single Custom Request Header

```php
// Fetch the container
Expand Down Expand Up @@ -136,7 +136,7 @@ This method will create a new header container, add the specified headers and th
header container in it's `Zend\Http\Request` object. As a consequence, any pre-existing headers will
be erased.

**Setting Multiple Custom Request Headers**
### Setting Multiple Custom Request Headers

```php
// Setting multiple headers. Will remove all existing
Expand All @@ -162,7 +162,7 @@ reads the file from the disk, the `mime_content_type` function will be used to g
content type, if it is available. In any case, the default MIME type will be
application/octet-stream.

**Using setFileUpload to Upload Files**
### Using setFileUpload to Upload Files

```php
// Uploading arbitrary data as a file
Expand Down Expand Up @@ -194,7 +194,7 @@ You can use a `Zend\Http\Client` to send raw POST data using the `setRawBody()`
takes one parameter: the data to send in the request body. When sending raw POST data, it is
advisable to also set the encoding type using `setEncType()`.

**Sending Raw POST Data**
### Sending Raw POST Data

```php
$xml = '<book>' .
Expand Down Expand Up @@ -225,7 +225,7 @@ method takes 3 parameters: The user name, the password and an optional authentic
parameter. As mentioned, currently only basic authentication is supported (digest authentication
support is planned).

**Setting HTTP Authentication User and Password**
### Setting HTTP Authentication User and Password

```php
// Using basic authentication
Expand Down Expand Up @@ -271,7 +271,7 @@ performed in more than one script in your application, it might be a good idea t
object in the user's session. This way, you will only need to authenticate the user once every
session.

**Performing consecutive requests with one client**
### Performing consecutive requests with one client

```php
// First, instantiate the client
Expand Down Expand Up @@ -327,7 +327,8 @@ stored, and `getStream()` will return stream from which the response could be re
You can either write the response to pre-defined file, or use temporary file for storing it and send
it out or write it to another file using regular stream functions.

> ## Receiving file from HTTP server with streaming
### Receiving file from HTTP server with streaming

```php
$client-setStream(); // will use temp file
$response = $client-send();
Expand Down
6 changes: 3 additions & 3 deletions doc/book/zend.http.headers.md
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ No additional methods

## Examples

**Retrieving headers from a Zend\\Http\\Headers object**
### Retrieving headers from a Zend\\Http\\Headers object

```php
// $client is an instance of Zend\Http\Client
Expand All @@ -990,7 +990,7 @@ There are three possibilities for the return value of the above call to the `get
- If more than one Content-Type header was set in the Request, `get` will return an ArrayIterator
containing one `Zend\Http\Header\ContentType` instance per header.

**Adding headers to a Zend\\Http\\Headers object**
### Adding headers to a Zend\\Http\\Headers object

```php
$headers = new Zend\Http\Headers();
Expand Down Expand Up @@ -1024,7 +1024,7 @@ $headers->addHeaders(array(
));
```

**Removing headers from a Zend\\Http\\Headers object**
### Removing headers from a Zend\\Http\\Headers object

We can remove all headers of a specific type using the `removeHeader` method, which accepts a single
object implementing `Zend\Http\Header\HeaderInterface`
Expand Down
8 changes: 4 additions & 4 deletions doc/book/zend.http.request.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ Returns string

## Examples

**Generating a Request object from a string**
### Generating a Request object from a string

```php
use Zend\Http\Request;
Expand All @@ -397,7 +397,7 @@ $request->getVersion(); // returns Request::VERSION_11 or '1.1'
$request->getContent(); // returns 'Some Content'
```

**Retrieving and setting headers**
### Retrieving and setting headers

```php
use Zend\Http\Request;
Expand All @@ -411,7 +411,7 @@ foreach ($request->getHeaders() as $header) {
}
```

**Retrieving and setting GET and POST values**
### Retrieving and setting GET and POST values

```php
use Zend\Http\Request;
Expand All @@ -425,7 +425,7 @@ $request->getPost('foo'); // returns 'Foo value'
$request->getQuery()->offsetGet('bar'); // returns 'Bar value'
```

**Generating a formatted HTTP Request from a Request object**
### Generating a formatted HTTP Request from a Request object

```php
use Zend\Http\Request;
Expand Down
4 changes: 2 additions & 2 deletions doc/book/zend.http.response.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ Returns string

## Examples

**Generating a Response object from a string**
### Generating a Response object from a string

```php
use Zend\Http\Response;
Expand All @@ -332,7 +332,7 @@ HeaderField2: header-field-value2
EOS);
```

**Generating a formatted HTTP Response from a Response object**
### Generating a formatted HTTP Response from a Response object

```php
use Zend\Http\Response;
Expand Down

0 comments on commit ebf426e

Please sign in to comment.