function ($url = '') { $response = []; if (!V::url($url)) { $response['status'] = 'error'; $response['error'] = 'The $url variable is not an url'; } else { try { $embed = new Embed\Embed(); $embed = $embed->get($url); $response['status'] = 'success'; $response['data'] = array( 'title' => $embed->title, 'description' => $embed->description, 'url' => $embed->url, 'tags' => $embed->keywords, 'image' => $embed->image, 'feeds' => $embed->feeds, 'code' => $embed->code ? $embed->code->html : null, 'width' => $embed->code ? $embed->code->width : null, 'height' => $embed->code ? $embed->code->height : null, 'aspectRatio' => $embed->code ? $embed->code->ratio : null, 'authorName' => $embed->authorName, 'authorUrl' => $embed->authorUrl, 'providerIcon' => $embed->icon, 'providerName' => $embed->providerName, 'providerUrl' => $embed->providerUrl, 'publishedTime' => $embed->publishedTime, 'license' => $embed->license, ); if ($response['data']['providerName'] === 'Instagram') { $response['data']['code'] = '
'; } } catch (Exception $e) { $response['status'] = 'error'; $response['error'] = $e->getMessage(); } } return $response; } );