This website works better with JavaScript.
Home
Explore
Help
Register
Sign In
nielsperetzke
/
healthchecks
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Projects
0
Releases
32
Wiki
Activity
Browse Source
Merge pull request
#395
from smknstd/master
[docs] add php curl example with timeout and retry options
pull/399/head
Pēteris Caune
4 years ago
committed by
GitHub
parent
e89229a2ca
2cb0ac907d
commit
4324843c41
No known key found for this signature in database
GPG Key ID:
4AEE18F83AFDEB23
1 changed files
with
14 additions
and
1 deletions
Unified View
Diff Options
Show Stats
Download Patch File
Download Diff File
+14
-1
templates/docs/php.md
+ 14
- 1
templates/docs/php.md
View File
@ -4,4 +4,17 @@ 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.
Write
Preview
Loading…
Cancel
Save