C.27 HttpGetTask
Prev | Appendix C. Optional tasks | Next

## C.27 HttpGetTask

This task will download a file through HTTP GET and save it to a specified directory. You need an installed version of HTTP_Request2 to use this task.

Table C.28: Attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
`url` | `String` | The request URL | n/a | Yes
`dir` | `String` | The directory to save the file | n/a | Yes
`filename` | `String` | The filename for the downloaded file | The filename part of the URL | No
`followRedirects` | `Boolean` | Whether to follow HTTP redirects | false | No
`sslVerifyPeer` | `Boolean` | Whether to verify SSL certificates | true | No
`authUser` | `String` | The authentication user name | n/a | No
`authPassword` | `String` | The authentication password | n/a | No
`authScheme` | `String` | The authentication scheme | basic | No

### C.27.1 Example

    <httpget url="http://buildserver.com/builds/latest.stable.tar.bz2" dir="/usr/local/lib"/>

### C.27.2 Supported Nested Tags

- `config`

  Holds additional config data. See HTTP_Request2 documentation for supported values.

  Table C.29: Attributes

  Name | Type | Description | Default | Required
  --- | --- | --- | --- | ---
  `name` | `String` | Config parameter name | n/a | Yes
  `value` | Mixed | Config value | n/a | Yes

- `header`

  Holds additional header `name` and `value`.

  Table C.30: Attributes

  Name | Type | Description | Default | Required
  --- | --- | --- | --- | ---
  `name` | `String` | Header name | n/a | Yes
  `value` | `String` | Header value | n/a | Yes

### C.27.3 Global configuration

In addition to configuring a particular instance of `HTTP_Request2` via nested `<config>` tags it is also possible to set default configuration values for `HttpGetTask` / `HttpRequestTask` by setting `phing.http.*` properties.

    <property name="phing.http.proxy" value="socks5://localhost:1080/"/>
    <!-- This request will go through the default proxy -->
    <httpget url="http://example.com/file.zip" dir="./"/>
    <httpget url="http://example.org/file.exe" dir="./">
        <!-- This proxy will be used instead of the default one -->
        <config name="proxy" value="http://foo:bar@proxy.example.org:3128/"/>
    </httpget>

Prev | Up | Next
C.26 GrowlNotifyTask | Home | C.28 HttpRequestTask