1. Go to this page and download the library: Download unl/oembedresource library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
unl / oembedresource example snippets
php
use unl\OembedResource\OembedResource;
...
// Instantiate OembedResource class and add oEmbed parameters as properties.
$resource = new OembedResource('video');
$resource->setTitle('My Video');
$resource->setHtml('<iframe src="https://example.com/video/123/embed" title="My Video" allowfullscreen frameborder="0"></iframe>');
$resource->setWidth(940);
$resource->setHeight(549);
$resource_payload = $resource->generate();
// At this point, return an HTTP response.
header('Content-Type: application/json+oembed');
echo $resource_payload;
die();
php
$resource = new OembedResource('video');
php
// By default, JSON is generated.
$json_payload = $resource->generate();
$json_payload = $resource->generate('json');
// XML can also be generated.
$xml_payload = $resource->generate('xml');