healthchecks_healthchecks/templates/docs/php.html-fragment
Pēteris Caune b9996e63c8
Fix django-compressor warning with github_actions.html
HTML files in /templates/docs/ are not Django templates,
they contain HTML content to be used verbatim in
hc.front.views.serve_doc view.

Some of these files contain "{{ ... }}" syntax. When
we run "./manage.py compress", django-compressor trips
up on this syntax because it treats them as Django templates.

The fix is to change file extension for these files
from .html to something else (I picked .html-fragment)
so django-compressor would ignore them.
2023-04-11 20:34:31 +03:00

17 lines
1.4 KiB
Plaintext

<h1>PHP</h1>
<p>Below is an example of making an HTTP request to SITE_NAME from PHP.</p>
<div class="highlight"><pre><span></span><code><span class="nb">file_get_contents</span><span class="p">(</span><span class="s1">&#39;PING_URL&#39;</span><span class="p">);</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>
<div class="highlight"><pre><span></span><code><span class="k">use</span> <span class="nx">Curl\Curl</span><span class="p">;</span>
<span class="nv">$curl</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Curl</span><span class="p">();</span>
<span class="nv">$curl</span><span class="o">-&gt;</span><span class="na">setRetry</span><span class="p">(</span><span class="mi">20</span><span class="p">);</span>
<span class="nv">$curl</span><span class="o">-&gt;</span><span class="na">setTimeout</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span>
<span class="nv">$curl</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">&#39;PING_URL&#39;</span><span class="p">);</span>
</code></pre></div>
<p>Note: this code does not throw any exceptions.</p>