Forums Register Login

Fake a post request from java class

+Pie Number of slices to send: Send
Hi all,

I'm a new comer here, nice to meet you all. I have a problem and need your help.
I send a post request from my java class but the target page doesn't process my request.
This is my source code, I think there's no problem in my source:


and the url I use is:
http://noip.gov.vn/noip/feedback.nsf/frmFeedbackv3?OpenForm&Language=English
+Pie Number of slices to send: Send
"hura no name", please check your private messages regarding an important administrative matter.
+Pie Number of slices to send: Send
That's a lot of code. What, exactly, happens if you run it? "doesn't process" gives us nothing to work with. Have you used an HTTP monitoring tool (like the Firefox extension LiveHttpHeaders) to observe how the HTTP sent by browser is different from the HTTP sent by your code?
+Pie Number of slices to send: Send
 

Ulf Dittmer wrote:That's a lot of code. What, exactly, happens if you run it? "doesn't process" gives us nothing to work with. Have you used an HTTP monitoring tool (like the Firefox extension LiveHttpHeaders) to observe how the HTTP sent by browser is different from the HTTP sent by your code?


Sry for not very clear explaination.

When I run that code, the content of the response I get is the same as the page that contains the form.Let's say, I have a form A, I submit it with parameter then it should return me "Submit success" or "Submit failed". But what I receive is still the form A.
+Pie Number of slices to send: Send
OK.

Ulf Dittmer wrote:Have you used an HTTP monitoring tool (like the Firefox extension LiveHttpHeaders) to observe how the HTTP sent by the browser is different from the HTTP sent by your code?

 
+Pie Number of slices to send: Send
 

Ulf Dittmer wrote:OK.

Ulf Dittmer wrote:Have you used an HTTP monitoring tool (like the Firefox extension LiveHttpHeaders) to observe how the HTTP sent by the browser is different from the HTTP sent by your code?



I've just install LiveHttp headers add-on.
When I submit form from firefox, I can see the sent data that I input the form. Then I clear the content of LiveHttp and run my java source -> nothing happens, the LiveHttp is empty.
+Pie Number of slices to send: Send
 

Then I clear the content of LiveHttp and run my java source -> nothing happens, the LiveHttp is empty.


Of course it is. It's a browser plugin, so it can be used to monitor browser traffic, not any HTTP traffic originating from your machine. But you can use its output to compare it to your Java source code, to see whether that would generate the same output.

If you want to monitor all HTTP traffic, use an HTTP proxy.
+Pie Number of slices to send: Send
Too many comments :(
+Pie Number of slices to send: Send
one of the problems is that you need to append the GET params (the name-value pairs after the ? mark in the target URL) in the post string too (see code lines 229 to 231 below) ...

good advice - if you have the time is to use: apache http client http://hc.apache.org/ . will be better in the long run ... more robust and covers more cases including file upload, authorization etc

if you do not want something so heavy can use this code






I'm doing laundry! Look how clean this tiny ad is:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2778 times.
Similar Threads
Login to web server with HttpClient
Logging into a forum
error while submitting an http web request
post url connection not working
POST and Get Http Method
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:36:54.