Hi,
I need to program to check the validity of IP address through PHP
Initially I used this one:
$url="http://www.ntc.gov.au/ViewPage.aspx?
page=A024003045 00100020";
$fp=fopen($url, "r");
if(!$fp)
{
echo "Failed";
}else
{
echo "success";
}
when I run it, it's output is "Failed",
I then use
$fp=fsockopen($ url,80); for second line, and also failed.
This IP address is actually good.
Butwhen I check "www.ntc.gov.au " it is success.
So does that mean by using PHP, we can only check hostname? And if the
IP address is longer and includes the appendix, we can not check it by
PHP?
Or do you have another good solutions?
Thanks in advance.
Frank
I need to program to check the validity of IP address through PHP
Initially I used this one:
$url="http://www.ntc.gov.au/ViewPage.aspx?
page=A024003045 00100020";
$fp=fopen($url, "r");
if(!$fp)
{
echo "Failed";
}else
{
echo "success";
}
when I run it, it's output is "Failed",
I then use
$fp=fsockopen($ url,80); for second line, and also failed.
This IP address is actually good.
Butwhen I check "www.ntc.gov.au " it is success.
So does that mean by using PHP, we can only check hostname? And if the
IP address is longer and includes the appendix, we can not check it by
PHP?
Or do you have another good solutions?
Thanks in advance.
Frank
Comment