Probably because the function only sets aside X seconds to retrieve the page title, if the URL is slower, it would just ignore it.
Anyway, they just retrieve the page and then do a regex on it like so:
preg_match('/<title>([^>]*)<\/title>/si', $contents, $match );
I would choose ruby on rails, but if you go for PHP, at least save yourself some pain and use a popular PHP framework such as Yii, Kohana, Codeigniter, Zend Framework or CakePHP.