title: Laravel 5 php DOMdocument
body: <p>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. </p>
  
  <p>I need to get title and/or video ID from youtube page, or any other page.</p>
  
  <p>Ive tried to include this <a href="http://simplehtmldom.sourceforge.net/manual.htm" rel="nofollow">simplehtmldom</a></p>
  
  <p>and other things.
  But I always get server 500 error and don't know why.</p>
  
  <p>Currently I have</p>
  
  <pre><code>$dom = new \DOMDocument();
  $dom-&gt;loadHTML('https://www.youtube.com/watch?v=QQ7XJG0Z2ho');
  $a = $dom-&gt;getElementsByTagName('title');
  </code></pre>
  
  <p>And on my view I just do</p>
  
  <pre><code>@if(isset($a))
      {{var_dump($a)}}
  @endif
  </code></pre>
  
  <p>It returns</p>
  
  <pre><code>object(DOMNodeList)#171 (1) { ["length"]=&gt; int(0) }
  </code></pre>
  
  <p>But this is not the title. Don't even know what this means.
  Can anyone tell what I'm doing wrong or maybe there is better way to do it?</p>