|
Posted by Jerry Stuckle on 02/23/07 01:54
xhe wrote:
> 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=A02400304500100020";
>
> $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
>
What do you mean by the "validity of the IP address"? For instance,
your fsockopen only works if the target system has a web server running
(same with fopen).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|