Poniżej załączam klasę (moja pierwsza w zyciu, wiec błedów zapewne masa).
<?php
class meta
{
var $adres;
var $description;
var $keywords;
var $title;
function ADR($adres)
{
if(!ereg('^http://', $adres)) $this->adres = "http://" . $adres;
}
function VIEW($co)
{
}
function IF_EXISTS($adres)
{
die("Page not found.nUsage: http://meta.rutkatartak.info/index.php/google.com"); }
function META_TAGS($what)
{
$this->$what = $tags[$what];
$this->VIEW($what);
}
// WYSZUKUJE TYTUL STRONY
function TITLE()
{
$plik = @fopen($this->adres, r
);
$q_title_start = "<title>";
$q_title_end = "</title>";
$all_data = "";
for($i=1;$i<=100;$i++)
{
{
$all_data .= $dane;
# echo "STARTn";
if(stristr($dane, $q_title_end)) break; else
{
for($i;$i<100;$i++)
{
{
$all_data .= $dane;
# echo "ENDn";
break;
}
else
{
$all_data .= $dane;
# echo "NEW LINEn";
}
}
}
}
}
if(!strstr($all_data, $q_title_start)) {
}
$all_data=split($q_title_start,$all_data); $all_data=split("</",$all_data[1
]);
$all_data[0
] = trim($all_data[0
]);
if(strlen($all_data[0
]) > 47
) { $all_data[0
] = substr($all_data[0
], 0
, 47
); $all_data[0] .= "..."; } $this->title = $all_data[0];
$this->VIEW("title");
}
}
?>