IPv6 website test

This tool will lookup A & AAAA records for a hostname to see if they exist. It will also display reverse DNS records for the A & AAAA records. Finally it retrieves the webpage title using IPv4 and IPv6 if availeble.

Found A record (IPv4):		$ipv4 ($ipv4Rev)\n";
    echo "No A record (IPv4) found!\n";

  if (isSet($ipv6))
    echo "Found AAAA record (IPv6):	$ipv6 ($ipv6Rev)\n";
    echo "No AAAA record (IPv6) found!\n";
  echo "
"; // Show page titles if (isSet($ipv4)) echo getURL("http://" . $_GET[host], 4); if (isSet($ipv6)) echo getURL("http://" . $_GET[host], 6); $myFile = "history.log"; $fh = fopen($myFile, 'a') or die("can't open logfile"); $stringData = "\n$_GET[host] ("; if ($v[4]) $stringData .= "IPv4"; if (!$v[4]) $stringData .= "IPv4"; $stringData.= "/"; if ($v[6]) $stringData .= "IPv6"; if (!$v[6]) $stringData .= "IPv6"; $stringData.= ")"; fwrite($fh, $stringData); fclose($fh); } function getURL($url, $ipv) { global $v; if ($ipv==4) $curlipv=CURL_IPRESOLVE_V4; if ($ipv==6) $curlipv=CURL_IPRESOLVE_V6; $curl = curl_init($url); curl_setopt($curl, CURLOPT_FAILONERROR, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, $curlipv, true); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($curl); if (preg_match('/(.+)<\/title>/', $result, $matches) && isset($matches[2])) { $v[$ipv] = true; return "IPv$ipv page title: $matches[2]\n"; } else { $v[$ipv] = false; return "IPv$ipv page title: ???"; } } echo "

Recent checks:\n"; $file = file("history.log"); for ($i = count($file)-6; $i < count($file); $i++) { echo $file[$i]; } //echo "

DNS info:\n"; //print_r($dns_record); ?>