• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to check if a connection to a webpage worked?  RSS feed

 
Ali Moghrabi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all!

My intentions are to visit a web page using a proxy. These proxies are unreliable in nature; they can work flawlessly right now but die on you a minute later. I have noticed when playing around with Java Http connections and proxies is that although I get a 200 response code (connection has been made without any troubles), this doesn't determine if I have connected to my intended website. For example, the proxy may redirect me to a webpage for an advertisement or to a webpage saying that this proxy is blocked from visiting this website. What is the proper way of checking that I have reached my intended website? The solution I have come up with is to scan for something on the webpage (through its source code) which will indicate to me that it did make it to my webpage. I feel there is a better way of doing this - does anyone have any suggestions? Thanks so much!
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Why are you using a proxy? My first reaction would be to use one that is under your control; is that not feasible?
 
Ali Moghrabi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Welcome to JavaRanch.

Why are you using a proxy? My first reaction would be to use one that is under your control; is that not feasible?


Thanks for having me here! There may be later options in the future that I may be able to get a hold of a proxy/proxies that would be under my control. However, at the moment my client would like me to stick with these types of proxies which isn't a big fuss. I may have over exaggerated their nature; for the most part they're reliable but depending if I grab a 'bad' one, it can die fairly quickly at random times.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!