title: PHP DOM Get website all scripts src
body: <p>I am want to get all scripts src links from a website using curl and DOM.</p>
  
  <p>I have this code:</p>
  
  <pre><code>$scripts = $dom-&gt;getElementsByTagName('script');
  
  foreach ($scripts as $scripts1) {
  
      if($scripts1-&gt;getAttribute('src')) {
  
          echo $scripts1-&gt;getAttribute('src');
  
      }
  
  }
  </code></pre>
  
  <p>This script working perfeclty but what happens if a website has a script tag like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  window._wpemojiSettings = {"source":{"concatemoji":"http:\/\/domain.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.2.4"}}; ........
  &lt;/script&gt;
  </code></pre>
  
  <p>I need also to get this script src. How can I do that?</p>