File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servlets(networking & http) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlets(networking & http)" Watch "Servlets(networking & http)" New topic
Author

Servlets(networking & http)

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
We are writing a search engine, which takes information from other search engines.
For this we need to send information to server side scripts of other web sites.
We accomplished this using GET method, but how to do it, when the server side script on the other site is expecting data from POST method.
Finally, is it legal to take information from other sites like this.
Please consider the matter very very urgent
Thanks
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Yes you can, get the servlet to open a Socket to the server as if you were making a request, send the request and read the response.
The difficulty is getting the HTTP Header right. It's just a matter of writing some text and I have an example of a POSTed header around I'll just go look for it...
OK, here's an example of the HTTP header of a page I sumbitted to myself:

Most of the fields can be ignored, it's mostly the first line and the 'hideme=124&hideme2=124' that's important bit.
Also remeber that you need to send an extra CR at the end of your request (basically send an extra empty line) to tell the server that the request is finished otherwise it'll just sit there waiting...
Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlets(networking & http)