Skip to content

Instantly share code, notes, and snippets.

@usingthesystem
Created November 15, 2016 21:29
Show Gist options
  • Save usingthesystem/879491d2690974c97ebc810fecdf5977 to your computer and use it in GitHub Desktop.
Save usingthesystem/879491d2690974c97ebc810fecdf5977 to your computer and use it in GitHub Desktop.
Get all script tags from a string
<?php
$js = "";
$content = file_get_contents("http://website.com");
preg_match_all('#<script(.*?)</script>#is', $content, $matches);
foreach ($matches[0] as $value) {
$js .= $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment