This little snippet will show you how to get string contain the title of an HTML file that located between
First, create a string containing the HTML file:
< ?php
$a = fopen("html_file.html","r");
$string = fread($a,1024);
?>
Why we just read 1024 bytes? Because the <title> tag mostly located at the top part, which is covered by first 1024 byte. Well, actually it’s up to you how many byte you will read. :p
Then simply filter the string using eregi() function. We use eregi() so it will filter both TITLE and title tag (case insensitive).
< ?php
// get text inbetween
if (eregi("
$outdata = $out[1];
}
// display it
echo $outdata.
?>
Happy coding! ^_*
andiwijaya
Dengan begitu title tiap halaman bisa sama ya? bukannya malah lebih baik title itu spesifik tiap halaman.
agung
yap, itu ngambil diantara kok mas andi.
Saya sendiri malah kaget liat iklannya.. “Gay Wedding Rings” ? haha
*banner mencerminkan pemilik website*
ask
It’s remarkable in favor of me to have a site,
which is valuable designed for my knowledge. thanks admin