From 1ffa65c88b570aca2b5d3b9b7202e30beeee2fe7 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 5 Dec 2014 05:06:52 +0100 Subject: Made it ipv6 ready. --- header/index.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'header/index.php') diff --git a/header/index.php b/header/index.php index 056cde5..6fd41e0 100644 --- a/header/index.php +++ b/header/index.php @@ -42,6 +42,15 @@ if ( $set ){ require '../tools/class/redis.php'; + function ipv6($ip){ + + if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) ) { + return true; + } + + return false; + } + $redis = new Database(REDIS_CONNECT, 9); $key = md5( $url . $method . serialize($customHeader) ); @@ -51,7 +60,14 @@ if ( $set ){ } $agent = "Retrieve HTTP headers online. v0.1"; - $ch = curl_init($url); + $ch = curl_init(); + + if ( ipv6($url) ){ + $url = "[".$url."]"; + curl_setopt($ch,CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6); + } + + curl_setopt ($ch, CURLOPT_URL,$url ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); -- cgit v1.2.3