IP адрес в IPv4 и IPv6 форматах

Жесткая отправка IP

<?php
define("API_USER", "nature-photographing");
define("API_KEY", "03.35127430:8444db9104d2cd6cd76ac4b3b0abe157");
function Request($url)
{заходить на Yandex
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); 
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
?>

Таким дивним способом:
[14:32:42] andrush85-skype: https://yadi.sk/i/2ds7ciNRkeGqE
[14:33:07] andrush85-skype: При запиті вказувати свій IP у форматы IPv6 завжди.
[14:33:26] andrush85-skype: Але працюэ тільки на php 5.4
[14:33:58] andrush85-skype: на 5.2

 curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );

або

 curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6 );

визиваэ помилку
[14:34:18] andrush85-skype: А тільки

$my_ip = "2a01:4f8:150:41ec::2";

не допомагає.

Print Friendly Version of this pagePrint Get a PDF version of this webpagePDF