<?php
/***************************************************************************
============================================================================
| @ Script Name : Get Tag Value
| @ Version : 1.0
| @ Description : Get The Tag Value .
| @ All rights reserved to : NaiF PHP
| @ Created In : 09-07-2007
| @ Support : wald_al_dala@hotmail.com
============================================================================
****************************************************************************/
class GTV
{
# Public #
var $path;
var $start_tag;
var $end_tag;
# Private #
var $tag_value;
var $conts = "";
var $DefineError = array(
" please enter the start and the end of the requested tag",
" the start tag must be the same as the end tag",
" please enter the url of the page you want request tags from ",
" unable to reach the requested page ",
" sorry .. unable to get the requested tags ",
" error .. the starting and ending tags must be an array "
);
// to start find you tag value ...
function GTV($path,$start_tag,$end_tag)
{
$this->path = $path;
$this->start_tag = $start_tag;
$this->end_tag = $end_tag;
// fro find your tag & return value him
// array or one tag(s)
function GetTagValue()
{
if(($_cont = $this->LoadPage()) != $this->DefineError[2])
{
if(is_array($this->start_tag) && is_array($this->end_tag))
{
foreach($this->start_tag as $id=>$tag)
{
$ST = $this->start_tag[$id];
$ET = $this->end_tag[$id];
// for return the contents you file ..
function LoadPage()
{
if($this->path == "")
{
$this->conts = $this->DefineError[2];
}
else
{
$open_file = @fopen($this->path, 'r') or die ($this->DefineError[3]);
/***************************************************************************
============================================================================
| @ Script Name : Get Tag Value
| @ Version : 1.0
| @ Description : Get The Tag Value .
| @ All rights reserved to : NaiF PHP
| @ Created In : 09-07-2007
| @ Support : wald_al_dala@hotmail.com
============================================================================
****************************************************************************/
echo (" <html dir=\"ltr\">\n<title> Get Tag Value </title> ");
include "GTV.class.php";
//======================================
// Note :
// write Start Tag like this : <tag>
// = = = = = : <\/tag>
// example (1) :
//======================================
$ob = new GTV(
"test.php",
array("<title>","<h3>","<font color=\"red\">"),
array("<\/title>","<\/h3>","<\/font>")
);
echo "<pre>";
print_r ($ob->tag_value);
//======================================
// example (2) :
//======================================
echo "<br><hr><br>";
$ob = new GTV(
"test.php",
"<head>",
"<\/head>"
);
echo "<pre>";
print_r ($ob->tag_value);
//======================================
// example (3) :
//======================================
echo "<br><hr><br>";;
$ob = new GTV(
"test.php",
"<title>",
"<\/title>"
);
echo "<pre>";
echo $ob->tag_value;
//======================================
// your can using this class to do : Ex 4
// example (4) :
//======================================
echo "<br><hr><br>";;
$ob = new GTV(
$_SERVER['HTTP_REFERER'],
"<title>",
"<\/title>"
);