开发者

Getting Yahoo IP address is not working

开发者 https://www.devze.com 2022-12-22 06:21 出处:网络
I get the Yahoo IP address using InetAddress class in java. The result of yahoo.com IP address is not working while given in URL of web browsers.

I get the Yahoo IP address using InetAddress class in java. The result of yahoo.com IP address is not working while given in URL of web browsers.

InetAddress[] all =   InetAddress.getAllByName("www.yahoo.com");
for (int i=0; i<all.length; i++)
{
    System.out.println("  address = " + all[i]);
}

It shows result as, address = www.yahoo.com/67.195.160.76 address = www.yahoo.com/69.147.125.65

When i entered those ip into browser's url(ie., http://67.195.160.76), the browser shows "Requisted URL not found".

What's the problem in that. 开发者_运维问答Is the result produced by the java program wrong?


The IP address is not wrong. However, the web server is told exactly what you type into the URL bar, and it can choose to show you different content based on the hostname that you use. In this case, a Yahoo web server (which is at that address) is choosing not to show you anything when you request the host 67.195.160.76.

This information is passed in the Host HTTP header. This header is the basis of how virtual hosts, or "vhosts", work.

0

精彩评论

暂无评论...
验证码 换一张
取 消