분류
php
Embera - An Oembed consumer library.
본문
Embera는 PHP로 작성된 Oembed 소비자 라이브러리입니다. 기본적으로 텍스트에서 URL을 가져와 일치하는 서비스에 미디어에 대한 정보를 쿼리합니다.
https://github.com/mpratt/Embera
Youtube, Twitter, Livestream, Dailymotion, Instagram, Vimeo 등 150 개 이상의 사이트를 지원합니다.
요구 사항
- PHP> = 7.0 (5.6에서 작동해야 함)
- Curl 또는 allow_url_fopen을 활성화해야 합니다.
기본 사용법
가장 일반적이거나 기본적인 예는 다음과 같습니다.
use Embera\Embera; $embera = new Embera(); echo $embera->autoEmbed('Hi! Have you seen this video? https://www.youtube.com/watch?v=J---aiyznGQ Its the best!');
마지막 예제는 다음 텍스트와 같은 내용을 반환합니다.
Hi! Have you seen this video? <iframe width="459" height="344" src="https://www.youtube.com/embed/J---aiyznGQ?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen ></iframe> Its the best!
URL에서 oembed 데이터를 검사 할 수도 있습니다.
use Embera\Embera; $embera = new Embera(); print_r($embera->getUrlData([ 'https://vimeo.com/374131624', 'https://www.flickr.com/photos/bees/8597283706/in/photostream', ]));
다음과 같은 결과가 반환됩니다.
Array ( [https://vimeo.com/374131624] => Array ( [type] => video [version] => 1.0 [provider_name] => Vimeo [provider_url] => https://vimeo.com/ [title] => VACATION movie [author_name] => Andrey Kasay [author_url] => https://vimeo.com/andreykasay [is_plus] => 0 [account_type] => basic [html] => <iframe src="......."></iframe> [width] => 426 [height] => 240 [duration] => 146 [description] => Остросюжетное кино про жизнь [thumbnail_url] => https://i.vimeocdn.com/video/832478725_295x166.jpg [thumbnail_width] => 295 [thumbnail_height] => 166 [thumbnail_url_with_play_button] => https://i.vimeocdn.com/......Fcrawler_play.png [upload_date] => 2019-11-19 06:27:37 [video_id] => 374131624 [uri] => /videos/374131624 [embera_using_fake_response] => 0 [embera_provider_name] => Vimeo ) [https://www.flickr.com/photos/bees/8597283706/in/photostream] => Array ( [type] => photo [flickr_type] => photo [title] => Durumu [author_name] => bees [author_url] => https://www.flickr.com/photos/bees/ [width] => 1024 [height] => 723 [url] => https://live.staticflickr.com/8385/8597283706_7b51ea50b1_b.jpg [web_page] => https://www.flickr.com/photos/bees/8597283706/ [thumbnail_url] => https://live.staticflickr.com/8385/8597283706_7b51ea50b1_q.jpg [thumbnail_width] => 150 [thumbnail_height] => 150 [web_page_short_url] => https://flic.kr/p/e6HjVq [license] => All Rights Reserved [license_id] => 0 [html] => ......... [version] => 1.0 [cache_age] => 3600 [provider_name] => Flickr [provider_url] => https://www.flickr.com/ [embera_using_fake_response] => 0 [embera_provider_name] => Flickr [html_alternative] => ........ ) )
- 이전글Question2Answer - PHP / MySQL에서 실행되는 Q & A 사이트를 위한 무료 오픈 소스 플랫폼 21.01.23
- 다음글PHP로 텔레그램 봇 구축 21.01.22