Browse Source

Use PING_URL placeholder in the PHP example.

pull/399/head
Pēteris Caune 4 years ago
parent
commit
2510e387e6
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
2 changed files with 26 additions and 5 deletions
  1. +21
    -2
      templates/docs/php.html
  2. +5
    -3
      templates/docs/php.md

+ 21
- 2
templates/docs/php.html View File

@ -1,4 +1,23 @@
<h1>PHP</h1> <h1>PHP</h1>
<p>Below is an example of making a HTTP request to SITE_NAME from PHP.</p> <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>
</code></pre></div>
<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>

+ 5
- 3
templates/docs/php.md View File

@ -3,10 +3,12 @@
Below is an example of making a HTTP request to SITE_NAME from PHP. 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('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 ```php
use Curl\Curl; use Curl\Curl;
@ -14,7 +16,7 @@ use Curl\Curl;
$curl = new Curl(); $curl = new Curl();
$curl->setRetry(20); $curl->setRetry(20);
$curl->setTimeout(5); $curl->setTimeout(5);
$curl->get('https://hc-ping.com/your-uuid-here');
$curl->get('PING_URL');
``` ```
Note: this code never throws any exception. Note: this code never throws any exception.

Loading…
Cancel
Save