Home | Independent | Web Technologies | PHP

PHP Link Checker

This PHP Link checker is used to determine whether a particular web page contains a link to another web site or page. The user needs to enter the URL of the link to search for on the page to be tested in the top text box, and the webpage to determine whether it contains the link in the second box. The program will load the page designated by the second text box and test to determine whether that page contains a link to the URL indicated by the first text box.

I grant permission for others to use and modify this code so long as they provide a link back to the Computer Technology Documentation Project website.

This is the PHP Link Tester program. It uses a template file to determine the output of the HTML format to be sent to the reader's internet browser. This is the source code for the PHP Link Tester. This is the template file. You will need both the source file and template file to implement the link tester.

  1. Right click on the links to both files and save them to your hard drive.
  2. Rename the file called "checkforurl.txt" to "checkforurl.php".
  3. To put the code on your website, you will need to modify the $abfilepath variable in the checkforurl.php file to match the absolute address of the directory that you will put the template.html file in. Your hosting provider can give you the absolute path to your main directory and you should be able to determine the rest of the information.

The template file contains embedded strings providing the capability to include any javascript form verification code and additional links which mainly allow the user to get back to the home page. The embedded strings are bracked both in front and behind by double exclaimation points (!). The included strings are:

  • !!content!! - Where the output of the contacts page will will be put. It must be included in your template file.
  • !!javascript!! - Used to indicate where to place the form verifying javascript. It must be placed in the header of your template file as shown in the example template file. It must be included in your template file.
  • !!title!! - Required only if you want your contacts page to have a title.
  • !!description!! - Optional but recommended. This is used to provide description of your web page in your META tags.
  • !!keywords!! - This item is optional in your template file and is used to provide keywords in your META tags.
  • !!linkscontent!! - Used to provide links on the left or the right side of the page which are normally listed vertically. This is optional but is intended to provide a link back to the home page or other pages,
  • !!horizlinks!! - Used to provide links on the top or bottom of the page which are normally listed horizontally. This is optional but is intended to provide a link back to the home page or other pages,

 

Author:  Mark Allen