topical media & game development

talk show tell print

professional-search-13-seophp-check-links.php / php



  <?php
  // include link checker library
  require_once 'include/link_checker.inc.php';
  ?>
  
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  <html>
    <head>
      <title>Professional Search Engine Optimization with PHP: Link Checker</title>
    </head>
    <body>
      <h1>Professional Search Engine Optimization with PHP: Link Checker</h1>
  
  <?php
  
  // stablish the URL to analyze
  url = "http://www.cristiandarie.ro/pages/seophp.aspx";
  
  // retrieve URL data
  responseHeader = LinkChecker::getHeader(url);
  statusCode = LinkChecker::parseResponseCode(responseHeader);
  mimeType = LinkChecker::parseMimeType(responseHeader);
  contentLength = LinkChecker::parseContentLength(responseHeader);
  location = LinkChecker::parseLocation(responseHeader);
  path = LinkChecker::getPath(url, responseCode);
  
  // display URL request data
  echo 'URL: ' . url . '<br />';
  echo 'Response header: ' . responseHeader . '<br />';
  echo 'Response status code: ' . statusCode . '<br />';
  echo 'Response MIME type: ' . mimeType . '<br />';
  echo 'Response content length: ' . contentLength . '<br />';
  echo 'Response location: ' . location . '<br />';
  
  // display the redirection path
  echo 'Path: <br />';
  for (i = 0; i < count(path); i++)
  {
    echo '&nbsp;&nbsp;' . path[i] . '<br />';
  }
  
  // display the HTTP status code of the last request 
  echo 'Final status code: ' . responseCode . '<br />';
  
  ?>
  
    </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.