This task will make an HTTP request to the provided URL and match the response against the provided regular expression. If an regular expression is provided and doesn't match the build will fail. You need an installed version of Guzzle to use this task.
Table C.41: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
url | String | The request URL | n/a | Yes |
responseRegex | String | The regular expression for matching the response | n/a | No |
responseCodeRegex | String | The regular expression for matching the response code | n/a | 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 |
verbose | Boolean | Whether to enable detailed logging | false | No |
method | String | The HTTP method of the request, currently only GET or POST supported | GET | No |
<http-request url="http://my-production.example.com/check-deployment.php"/>
Just perform a HTTP request to the given URL.
<http-request url="http://my-production.example.com/check-deployment.php" responseRegex="/Heartbeat/" verbose="true" observerEvents="connect, disconnect"/>
Perform a HTTP request to the given URL and matching the response against the given regex pattern. Enable detailed logging and log only the specified events.
<http-request url="http://my-production.example.com/check-deployment.php"> <header name="user-agent" value="Phing HttpRequestTask"/> </http-request>
Perform a HTTP request to the given URL. Setting request adapter to curl instead of socket. Setting an additional header.
<http-request url="http://my-production.example.com/check-deployment.php" verbose="true" method="POST"> <postparameter name="param1" value="value1" /> <postparameter name="param2" value="value2" /> </http-request>
Perform an HTTP POST request to the given URL. Setting POST request parameters to emulate form submission.
config
Holds additional config data. See Guzzle documentation for supported values.
Table C.42: 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.43: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
name | String | Header name | n/a | Yes |
value | String | Header value | n/a | Yes |
postparameter
Used when performing a POST request. Contains name
and
value
of a form field.
Table C.44: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
name | String | Field name | n/a | Yes |
value | String | Field value | n/a | Yes |
In addition to configuring a particular instance of Guzzle
via
nested <config>
tags it is also possible to set default
configuration values for HttpGetTask / HttpRequestTask
/ VisualizerTask by setting phing.http.*
properties.
<property name="phing.http.proxy" value="socks5://localhost:1080/"/> <!-- This request will go through the default proxy --> <http-request url="http://example.com/foo"/> <http-request url="http://example.org/restricted" dir="./"> <!-- This proxy will be used instead of the default one --> <config name="proxy" value="http://foo:[email protected]:3128/"/> </http-request>