HTML Elements Extractor

HTML Elements Extractor



Extract images, scripts and css files from an URL. Enter a website’s URL and hit Enter.

Invalid URL

‘;
} else {
?>

HTML Elements Breakdown

URL:

Images

    find(‘img’) as $element) {

    // Set Vars
    $img = $element->src;
    if (substr($img, 0, 2)==”//”) {
    $img_url = $img;
    }
    if (substr($img, 0, 5)==”http:”) {
    $img_url = $img;
    }
    if (substr($img, 0, 6)==”https:”) {
    $img_url = $img;
    }
    if ((substr($img, 0, 2)!=”//”) && (substr($img, 0, 5)!=”http:”) && (substr($img, 0, 6)!=”https:”)) {
    $img_url = “http://”.$DOMAIN.$element->src;
    }

    // Print output
    echo “

  • “.$img_url.”
  • “;
    } ?>


Scripts (JS)

    find(‘script’) as $element) {

    // Set Vars
    $script = $element->src;
    if (substr($script, 0, 2)==”//”) {
    $script_url = $script;
    }
    if (substr($script, 0, 5)==”http:”) {
    $script_url = $script;
    }
    if (substr($script, 0, 6)==”https:”) {
    $script_url = $script;
    }
    if ((substr($script, 0, 2)!=”//”) && (substr($script, 0, 5)!=”http:”) && (substr($script, 0, 6)!=”https:”)) {
    $script_url = “http://”.$DOMAIN.$element->src;
    }

    $embed = “http://”.$DOMAIN;

    // Print output
    if ($script_url == $embed) {
    echo “

  • “.$script_url.” (embedded)
  • “;
    } else {
    echo “

  • “.$script_url.”
  • “;
    }
    }?>


CSS (Stylesheets)

    find(‘link[rel=”stylesheet”]’) as $element) {

    // Set Vars
    $css = $element->href;
    if (substr($css, 0, 2)==”//”) {
    $css_url = $css;
    }
    if (substr($css, 0, 5)==”http:”) {
    $css_url = $css;
    }
    if (substr($css, 0, 6)==”https:”) {
    $css_url = $css;
    }
    if ((substr($css, 0, 2)!=”//”) && (substr($css, 0, 5)!=”http:”) && (substr($css, 0, 6)!=”https:”)) {
    $css_url = “http://”.$DOMAIN.$element->src;
    }

    $embed = “http://”.$DOMAIN;

    // Print output
    if ($css_url == $embed) {
    echo “

  • “.$css_url.” (embedded)
  • “;
    } else {
    echo “

  • “.$css_url.”
  • “;
    }
    }?>