Getting the title of a page in PHP
Posted
by Francesc
on Stack Overflow
See other posts from Stack Overflow
or by Francesc
Published on 2010-04-17T12:58:15Z
Indexed on
2010/04/17
13:03 UTC
Read the original article
Hit count: 221
Hi. When I want to get the title of a remote webiste, I use this script:
function get_remotetitle($urlpage)
{
$file = @fopen(($urlpage),"r");
$text = fread($file,16384);
if (preg_match('/<title>(.*?)<\/title>/is',$text,$found)) {
$title = $found[1];
} else {
$title = 'Title N/A';
}
return $title;
}
But when I parase a webiste title with accents, I get "?". But if I look in PHPMyAdmin, I see the accents correctly. What's happening?
© Stack Overflow or respective owner