I am looking for a code snippet that can get me the title of the url I enter.

something like if I pass

It should return Go4Expert - Begining with PHP

I have checked the internet and seen that curl of php can be useful but could not use it in a very good sense as I am not a PHP expert.