RRoEmbed is a PHP 5 library which provides an interface to consume oEmbed resources.
oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.
Read more: oEmbed website
<?php
// Include the autoloader.
require_once( dirname( __FILE__ ) . '/Classes/Autoloader.class.php' );
// Register the autoloader.
RRoEmbed_Autoloader::getInstance()->register();
// Create a new consumer.
$c = new RRoEmbed_Consumer();
// Call the "consume" method and supply it the URL of the resource you'd like
// to get the oEmbed representation of and the Provider instance.
$o = $c->consume(
'http://www.flickr.com/photos/romac17/4101838222/',
new RRoEmbed_Provider_Flickr()
);
// Notice you can also omit to specify the provider, if so the Consumer will try to
// automatically find a valid provider endpoint.
// $o = $c->consume( 'http://www.flickr.com/photos/romac17/4101838222/' );
print $o;
The code is licensed under the very liberal MIT license.