forked from GithubBackups/healthchecks
Use PING_URL placeholder in the PHP example.
This commit is contained in:
parent
4324843c41
commit
2510e387e6
@ -1,4 +1,23 @@
|
||||
<h1>PHP</h1>
|
||||
<p>Below is an example of making a HTTP request to SITE_NAME from PHP.</p>
|
||||
<div class="highlight"><pre><span></span><code><span class="x">file_get_contents('https://hc-ping.com/your-uuid-here');</span>
|
||||
<div class="highlight"><pre><span></span><code><span class="x">file_get_contents('PING_URL');</span>
|
||||
</code></pre></div>
|
||||
|
||||
|
||||
<p>If you would like to setup timeout and retry options, as discussed in the
|
||||
<a href="../reliability_tips/">reliability tips section</a>, there is a
|
||||
<a href="https://www.phpcurlclass.com/">curl package</a> available that lets you do that easily:</p>
|
||||
<p>```php startinline=True
|
||||
use Curl\Curl;</p>
|
||||
<p>$curl = new Curl();
|
||||
$curl->setRetry(20);
|
||||
$curl->setTimeout(5);
|
||||
$curl->get('PING_URL');
|
||||
```</p>
|
||||
<p>:::php
|
||||
use Curl\Curl;
|
||||
$curl = new Curl();
|
||||
$curl->setRetry(20);
|
||||
$curl->setTimeout(5);
|
||||
$curl->get('PING_URL');</p>
|
||||
<p>Note: this code never throws any exception.</p>
|
@ -3,10 +3,12 @@
|
||||
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');
|
||||
file_get_contents('PING_URL');
|
||||
```
|
||||
|
||||
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:
|
||||
If you would 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;
|
||||
@ -14,7 +16,7 @@ use Curl\Curl;
|
||||
$curl = new Curl();
|
||||
$curl->setRetry(20);
|
||||
$curl->setTimeout(5);
|
||||
$curl->get('https://hc-ping.com/your-uuid-here');
|
||||
$curl->get('PING_URL');
|
||||
```
|
||||
|
||||
Note: this code never throws any exception.
|
||||
|
Loading…
x
Reference in New Issue
Block a user