Use PING_URL placeholder in the PHP example.

This commit is contained in:
Pēteris Caune 2020-07-07 21:17:31 +03:00
parent 4324843c41
commit 2510e387e6
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
2 changed files with 26 additions and 5 deletions

View File

@ -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(&#39;https://hc-ping.com/your-uuid-here&#39;);</span>
<div class="highlight"><pre><span></span><code><span class="x">file_get_contents(&#39;PING_URL&#39;);</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-&gt;setRetry(20);
$curl-&gt;setTimeout(5);
$curl-&gt;get('PING_URL');
```</p>
<p>:::php
use Curl\Curl;
$curl = new Curl();
$curl-&gt;setRetry(20);
$curl-&gt;setTimeout(5);
$curl-&gt;get('PING_URL');</p>
<p>Note: this code never throws any exception.</p>

View File

@ -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.