Ive been trying to find a way to use php DOMdocument in laravel 5.1 but I fail every time. I think I don't get how it works.
I need to get title and/or video ID from youtube page, or any other page.
Ive tried to include this simplehtmldom
and other things. But I always get server 500 error and don't know why.
Currently I have
$dom = new \DOMDocument();
$dom->loadHTML('https://www.youtube.com/watch?v=QQ7XJG0Z2ho');
$a = $dom->getElementsByTagName('title');
And on my view I just do
@if(isset($a))
{{var_dump($a)}}
@endif
It returns
object(DOMNodeList)#171 (1) { ["length"]=> int(0) }
But this is not the title. Don't even know what this means. Can anyone tell what I'm doing wrong of maybe there is better way to do it?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire