<?php
$url = $_GET['url'];
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$contents = curl_exec($ch);
if (curl_errno($ch)) {
  echo curl_error($ch);
  echo "\n<br />";
  $contents = '';
} else {
  curl_close($ch);
}

if (!is_string($contents) || !strlen($contents)) {
echo "Failed to get contents.";
$contents = '';
}
// $doc = new DOMDocument();
// $doc->loadHTML($contents);
// $divs = $doc->getElementsByTagName('div');
// foreach($divs as $div) {    
//     if ($div->getAttribute('class') === 'view-content') {
//       // echo $div->nodeValue."<br/>";
//       // echo $div;
//     }
// }
echo $contents;
?>