From 2cb0ac907d7f9a1af72935151706520ba0339e32 Mon Sep 17 00:00:00 2001 From: Arnaud Becher Date: Tue, 7 Jul 2020 18:36:41 +0200 Subject: [PATCH] add php curl example with timeout and retry options --- templates/docs/php.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/templates/docs/php.md b/templates/docs/php.md index be674a48..4efa19e9 100644 --- a/templates/docs/php.md +++ b/templates/docs/php.md @@ -4,4 +4,17 @@ Below is an example of making a HTTP request to SITE_NAME from PHP. ```php file_get_contents('https://hc-ping.com/your-uuid-here'); -``` \ No newline at end of file +``` + +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.