I found a solution to exctract a page title from a URL:
$x = file_get_contents($URL);
preg_match("/<title>(.+?)<\\/title>/", $x, $match);
However, when trying on facebook it didnt work, it returned "Incompatible Browser | Facebook", is there another way to get this work on every site including FB?