PHP code example of marcelklehr / link-preview
1. Go to this page and download the library: Download marcelklehr/link-preview 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/ */
marcelklehr / link-preview example snippets
use Marcelklehr\LinkPreview\Client;
$previewClient = new Client(/*your http implementation here*/);
// Get previews from all available parsers
$previews = $previewClient->getLink('https://www.boogiecall.com/en/Melbourne')->getPreviews();
// Only get preview data from specific parser
$preview = $previewClient->getPreview('general');
// Convert output to array
$preview = $preview->toArray();
use Marcelklehr\LinkPreview\Client;
$previewClient = new Client(/*your http implementation here*/);
// Only parse YouTube specific information
$preview = $previewClient->getLink('https://www.youtube.com/watch?v=v1uKhwN6FtA')->getPreview('youtube');
var_dump($preview->toArray());