PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Hossam Suliman   URL Tool   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of class usage
Class: URL Tool
Parse and check the existence of a given URL
Author: By
Last change:
Date: 12 years ago
Size: 682 bytes


Class file image Download

 * Example of UrlTool class usage.
 * @author Hossamzee (
 * @date 11 Feb 2012.

/* Url to be parsed, validated, and checked. */
$url = "";

/* Create a new instance of URL class. */
$urlToolObj = new UrlTool();

/* Check if the url is valid (lexically). */
if ($urlToolObj->parseUrl($url, $error) !== false)
$result = sprintf("(%s) is lexically valid.\n", $url);
$result = sprintf("(%s) is lexically invalid.\nError: %s\n", $url, $error);

/* Print the result. */
echo "<pre>\n";