This snippet is more than 5 years old and may no longer be best practise, test before use.

YouTube Video XML using oembed

Use oembed to pull an xml of a YouTube video using its URL. Using simplexml_load_file you are able to convert the XML into an object for use.