Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>this is the code you want:</p> <pre><code>function StatusCheck($url) { $urlparts=parse_url($url); $curl=new CCurl($url); $headers=$curl-&gt;execute(); $headers=$curl-&gt;close(); $headers=$curl-&gt;getHeader(); $headers=split("\r\n",$headers); $status=$headers[0]; print_r($headers); if (strpos($status,"HTTP/1.1 200 OK")===FALSE) { echo date("d.m.Y H:i:s").$url,': bad'."\n"; return 0; } else { echo date("d.m.Y H:i:s").$url,': good'."\n"; return 1; } } </code></pre> <p>it checks the URL (link) provided and prints out the headers + info if the URL is bad (not working) or good (status 200 OK)</p> <p>PS: set curl options to follow redirection</p> <p>EDIT: this is the CCurl class, sorry forgot about it:</p> <pre><code>class CCurl { var $m_handle; var $m_header; var $m_body; function CCurl($sUrl) { $this-&gt;m_handle = curl_init(); curl_setopt($this-&gt;m_handle, CURLOPT_URL, $sUrl); curl_setopt($this-&gt;m_handle, CURLOPT_HEADER, 1); curl_setopt($this-&gt;m_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($this-&gt;m_handle, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($this-&gt;m_handle, CURLOPT_USERAGENT, "StatusCheckBot 0.1"); return; } function getHeader() { return $this-&gt;m_header; } function execute() { $sResponse = curl_exec($this-&gt;m_handle); $this-&gt;m_body = substr($sResponse, strpos($sResponse, "\r\n\r\n") + 4); $this-&gt;m_header = substr($sResponse, 0, -strlen($this-&gt;m_body)); return $this-&gt;m_body; } function close() { curl_close($this-&gt;m_handle); return; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload