Re: Are there any good solutions for checking the validity of IP address?



xhe wrote:
> On Feb 22, 8:30 pm, Rik <luiheidsgoe...@xxxxxxxxxxx> wrote:
>> xhe <hexuf...@xxxxxxxxx> wrote:
>>> The first line is the IP address that I am checking.
>>> It is
>>> $url="http://www.ntc.gov.au/ViewPage.aspx?page=A02400304500100020";;
>> Call me insane, I see no IP address. Do you mean a DNS, or a URL?
>> DNS:
>> <http://www.php.net/pareseurl>
>> <http://www.php.net/gethostbyname>
>>
>> URL checking should normally be possible with fopen(), if allow_url_fopen
>> is enabled.
>> --
>> Rik Wasmus
>
if we use this one
if(fopen("http://www.ntc.gov.au","r";))
{
echo "success";
}else
{
echo "false";
}
result is false.

with fsockopen, we can ONLY check "www.ntc.gov.au", and we can not
check if the whole url is reachable or not.
It seemed that fsockopen is only valid to check host name, while not
the whole ip string.

Any good idea to check the who ip string instead of just host name?

thanks.

That's because you need to send the request using HTTP headers (if trying to communicate with a Web server). Also, you're checking if a resource exists on a server, you're not checking an IP address. www.ntc.gov.au is a domain.

You should become best friends with Google for a while.

--
Curtis, http://dyersweb.com
.



Relevant Pages