$content = file_get_contents($Url); preg_match_all('#<title>.+</title>#', $content, $matches); $title = preg_replace('#(<title>|</title>)#', '', $matches[0][0]); This way I get the title from the URL. The problem is that not all sites have the same encoding, from most sites it turns out to extract the title, but the rest do not, displays rhombuses with question marks, do not write to the database at all. I tried to translate the resulting string into UTF-8, but so far to no avail.