on example.com is <video>
like:
<video controls="" preload="false" src="http://example.com/video.mp4"></video>
and I would like to get content of src=""
which is inside of that <video>
tag
(example.com is not my website, I need to use PHP to get to the HTML code and get the src from the video tag)
thank you!
Advertisement
Answer
Quick and dirty way
<?php preg_match_all('#<video .*?src="(.*?)"#', file_get_contents('https://example.com'), $results); print_r($results[1]);
A better way is to use web scraping/crawling tools like FriendsOfPHP/Goutte