Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

PHP

get the header response code number

1
2
3
4
function get_http_response_code($url) {
    $headers = get_headers($url);
    return substr($headers[0], 9, 3);
}
https://snipt.net/embed/6e481d16844e6fac6e0b65274a28d76b/
https://snipt.net/raw/6e481d16844e6fac6e0b65274a28d76b/
6e481d16844e6fac6e0b65274a28d76b
php
PHP
4
2016-12-02T19:05:35
True
False
False
/api/public/snipt/98720/
get-the-header-response-code-number
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">function get_http_response_code($url) {</span> </span><span id="L-2"><a name="L-2"></a><span class="x"> $headers = get_headers($url);</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> return substr($headers[0], 9, 3);</span> </span><span id="L-4"><a name="L-4"></a><span class="x">}</span> </span></pre></div> </td></tr></table>
header
Copyrighted, illegal, or inappropriate content? Email [email protected].