• Post Reply Bookmark Topic Watch Topic
  • New Topic

Errors Reading from URL !!

 
Terry Prazak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a small program that runs on a server and tries to connect to a certain URL to obtain information.
Problem 1:
I am using HTTP protocol but when I try to construct an URL object with an address like http://example.com it throws an UnkownHostException. I can get around this by supplying the raw ip instead like http://111.111.111.111
Is there another way to get around from having to supply the raw ip? I would rather use the domain name in case the ip changes on me.
Problem 2:
If I do use the raw ip then the next error that is thrown is FileNotFoundException. It seems that our provider for the http information i want to capture will not work if i replace the domain name with the raw ip. I can't explain this as I've tried both versions in a browser and the one with the raw ip just gives me a page not found error. Http://example.provider.com/get/content.html --> WORKS Http://111.111.111.111/get/content.html -------> PAGE NOT FOUND
To get the raw ip I went to the command window and just typed in 'ping example.provider.com'
I could really use some help on this by anyone who might have some insight to this.
**What is funny is that on all the machines that I test this on they will accept the domain name in the URL constructor. THe only one that doesn't is the live machine which seems to want the ip instead.
Thanks,
Terry.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!