forked from GithubBackups/healthchecks
Merge pull request #395 from smknstd/master
[docs] add php curl example with timeout and retry options
This commit is contained in:
commit
4324843c41
@ -5,3 +5,16 @@ Below is an example of making a HTTP request to SITE_NAME from PHP.
|
|||||||
```php
|
```php
|
||||||
file_get_contents('https://hc-ping.com/your-uuid-here');
|
file_get_contents('https://hc-ping.com/your-uuid-here');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you'd like to setup timeout and retry options, as discussed in the [reliability tips section](../reliability_tips/), there is a [curl package](https://www.phpcurlclass.com/) available that lets you do that easily:
|
||||||
|
|
||||||
|
```php
|
||||||
|
use Curl\Curl;
|
||||||
|
|
||||||
|
$curl = new Curl();
|
||||||
|
$curl->setRetry(20);
|
||||||
|
$curl->setTimeout(5);
|
||||||
|
$curl->get('https://hc-ping.com/your-uuid-here');
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: this code never throws any exception.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user