<?php

function extractElementsFromWebPage($webPage, $tagName) {
  //Creating a DOMDocument Object.
  $dom = new DOMDocument;

  //Parsing the HTML from the web page
  if ($dom->loadHTML($webPage)) {
    // Extracting the specified elements from the web page
    @$elements = $dom->getElementsByTagName($tagName);
    return $elements;
  }
  return FALSE;
}

function downloadURL($URL) {
  $webPage = file_get_contents ($URL);
  return $webPage;
}



$opts = array(
  'http'=>array(
    'method'=>"GET",
    'header'=>"Accept-language: en\r\n" .
              "Cookie: foo=bar\r\n"
  )
);

$context = stream_context_create($opts);

// Open the file using the HTTP headers set above
$file = file_get_contents('http://pixerlfire.net', false, $context);

















//$homepage = file_get_contents('http://aeropostale.massrel.io/social-now-main/');
//echo $homepage;

$webPage = downloadURL("http://aeropostale.massrel.io/social-now-main/");
if ($webPage ) {
  $URLs = extractElementsFromWebPage($webPage, 'iframe');
  if ($URLs) {
    foreach ($URLs as $URL){
      // Extracting the URLs
      echo $URL->getAttribute('src'), "<br />";
    }
  }
  else {
    echo "Error in parsing the webPagen";
  }
}
else {
  echo "Error in downloading the webPagen";
}
?>