I am trying to getting url in fopen -function, but only output is those error messages.
Warning: php_hostconnect: connect failed in F:\pubwww\html\php\ipv6.php on line 32
Warning: fopen("http://ankka.com:1000/?ip-txt", "r") - Bad file descriptor in F:\public\html\php\ipv6.php on line 32
Warning: fgets(): supplied argument is not a valid File-Handle resource in F:\public\html\php\ipv6.php on line 33
Warning: fclose(): supplied argument is not a valid File-Handle resource in F:\public\html\php\ipv6.php on line 34
PHP code (part that do not work):
$fp=fopen("http://ankka.com:1000/?ip-txt","r");
fgets($fp,$clientIP);
fclose($fp); // this is line 34
That address contains only my public ip address that should be read to $clientIP variable. Is this right way?
What is wrong this part of script? Or is there better solution, example something function like this ( get_public_ip() )?
PS. Sorry about bad english but I am from Finland.
LukeSW
edit: I am using Apache 2.0.46 (or 2.0.49, don't remember) and PHP 4.2.2 on Windows 2000 Pro.