Solved

how to POST data using httpurlconnection?

Posted on 2009-07-14
5
382 Views
Last Modified: 2012-05-07
for example i want send a data:

String Sdata1 = "data1";
String Sdata2 = "data2";

how to send data1 and data2?

variables that use  at php code:
$data1
$data2

mybe if just using GET, i just set the URL to : http://www.a.com/test.php?data1=Sdata1&data2=Sdata2
,then connect();

but how if post?
0
Comment
Question by:iphone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 24847838
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 24847858
the following shows you how to POST, basically include the query string in the 'body' instead of in the url

http://helpdesk.objects.com.au/java/how-do-i-send-a-post-request-using-java
0
 
LVL 92

Expert Comment

by:objects
ID: 24847862
and you don't need to use httpurlconnection
0
 

Author Closing Comment

by:iphone
ID: 31603190
thx to you both all work
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24876658
:-)
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question