38 satır
561 B
PHP
38 satır
561 B
PHP
<?php
|
|
|
|
use Graby\Graby;
|
|
use Fusonic\OpenGraph\Consumer;
|
|
|
|
/**
|
|
* Graby.
|
|
*
|
|
* @param string $url
|
|
* @return array
|
|
*/
|
|
function graby(string $url) : array
|
|
{
|
|
$graby = new Graby();
|
|
$result = $graby->fetchContent($url);
|
|
|
|
if (isset($result['headers'])) {
|
|
unset($result['headers']);
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Opengraph
|
|
*
|
|
* @param string $url
|
|
*
|
|
* @return array
|
|
*/
|
|
function opengraph(string $url) : array
|
|
{
|
|
$consumer = new Consumer();
|
|
$object = $consumer->loadUrl($url);
|
|
|
|
return json_decode(json_encode($object), true);
|
|
}
|