I just fell over this:
|<?php
function fixed_gethostbyname ($host) {
// Try the lookup as normal...
$ip = gethostbyname($host);
// ...but if it fails, FALSE is returned instead of the unresolved host
if ($ip != $host) { return $ip; } else return false;
}
?>|
Jesper Staun Hansen wrote:
> What would this simple test return:
> |<?php
> $ip = gethostbyname('www.example.com');
>
> echo $ip;
> ?>
>
> I dont remember if there's a difference between using " or '
>
> |
>
>
> David White wrote:
>
>> Can anyone help me here? If my code invokes gethostbyname("crap.crap"),
>>
>> it does not return the unmodified input (which should be crap.crap).
>> Instead it returns the IP of the server on which the code runs (in this
>>
>> case 140.211.166.81). This does not seem at all correct. Of course, the
>>
>> call should fail but the manual says that the return result should be
>> in
>> unmodified input in case of failure. Thanks,
>>
>> David
>>
>>
>>
>>
>>
>> ____________________________________________________________________________________
>> Looking for last minute shopping deals?
>> Find them fast with Yahoo! Search.
>> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>> _______________________________________________
>> Project_owners mailing list
>> [email protected]
>> https://www.mozdev.org/mailman/listinfo/project_owners
>>
>>
>>
>>
>
>
> _______________________________________________
> Project_owners mailing list
> [email protected]
> https://www.mozdev.org/mailman/listinfo/project_owners
>
>
>
_______________________________________________
Project_owners mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/project_owners