You are here

function lc_GetStatusCode in Link checker 5

1 call to lc_GetStatusCode()
lc_GetResponse in ./linkchecker.module

File

./linkchecker.module, line 526
This module periodically check html links referenced by drupal nodes Developed and maintained by Marek Tichy, marek@ecn.cz

Code

function lc_GetStatusCode($header) {

  // Splits the headers into an array
  $headers = explode("\r\n", $header);
  unset($header);
  for ($i = 0; isset($headers[$i]); $i++) {

    // Checks if the header is the status header
    if (preg_match("/HTTP\\/[0-9A-Za-z +]/i", $headers[$i])) {

      // If it is save the status
      $status = preg_replace("/http\\/[0-9]\\.[0-9]/i", "", $headers[$i]);
    }
  }
  return $status;
}