C.41 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.42: Attributes

urlStringThe request URLn/aYes
dirStringThe directory to save the filen/aYes
filenameStringThe filename for the downloaded fileThe filename part of the URLNo
followRedirectsBooleanWhether to follow HTTP redirectsfalseNo
sslVerifyPeerBooleanWhether to verify SSL certificatestrueNo
authUserStringThe authentication user namen/aNo
authPasswordStringThe authentication passwordn/aNo
authSchemeStringThe authentication schemebasicNo
quietBooleanIf true, set default log level to Project.MSG_ERRfalseNo

C.41.1 Example

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

C.41.2 Supported Nested Tags

  • config

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

    Table C.43: Attributes

    nameStringConfig parameter namen/aYes
    valueMixedConfig valuen/aYes

  • header

    Holds additional header name and value.

    Table C.44: Attributes

    nameStringHeader namen/aYes
    valueStringHeader valuen/aYes

C.41.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:[email protected]:3128/"/>