• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get response content of a website  RSS feed

 
ram gaurav
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Like through java.net.URL i am trying to connect to some site like www.google.com,now i want the response send by GOOGLE in text format not in HTML.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By just hitting the google web URL, you're going to get back HTML.

If you want more control, google has a rich toolkit of web services as well as a Java API that you can use to do pretty much whatever you want.
[ March 07, 2007: Message edited by: Bear Bibeault ]
 
ram gaurav
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply.

I have just taken example of google.com.
Like my code is :



Now just after this it gives me error.
Can you please tell us that where are we doing wrong

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you ping Yahoo from where you're running this code?

Servlet engines like Tomcat often run with a security manager, which may prohibit all kinds of activity, but particularly networking (although that doesn't seem to be the problem here).
 
ram gaurav
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply.

Actually Ping uses different protocol and HTTP is different.

Like i can simply type www.yahoo.com in my browser , it open an HTML page for , but i want the response as plain text not as HTML.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I was asking is whether you can connect to Yahoo from the machine where you're running that code. Does that mean the answer to that is "yes"? Is it the same machine on which you're running the browser? Are there any further exception in the Tomcat logs?
 
ram gaurav
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya i can connect to yahoo.com from my browser , but when i try to connect through my Servlet it give Connection Refused exception
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going to guess that you have some sort of security software running on that system. Many kinds of "malware" try to connect to urls for various nefarious reasons so security software may only allow outgoing connections to be made by known programs.

Bill
 
ram gaurav
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya , that can be the reason because we are running with some firewalls in our systems.

So how to proceed with that
 
ram gaurav
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

In my previous code i have add few things



and now Connection refused error is not coming, but now HTTP 403 ( Forbidden : The server understood the request, but is refusing to fulfill it. Typically due to file access permissions on the server. )

Can you please tell me that why it is not allowing me and giving HTTP 403 error.

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