S
S
Saymon_K2014-10-16 13:50:23
PHP
Saymon_K, 2014-10-16 13:50:23

How to send data to the server and get the result of PHP code?

I have code (Android):
URL url = new URL("my URL");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.connect();
And this code accesses PHP file with code:
<?
$login = $_POST["login"];
$pswd = $_POST["pswd"];
$str = "done";
echo $str;
?>
How do I get the result of the PHP code, that is, the line "Done"?
And How can I send data using HttpURLConnection so that $_POST is not empty?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
brutal_lobster, 2014-10-16
@Saymon_K

www.xyzws.com/javafaq/how-to-use-httpurlconnection... Have a
look at org.apache.commons.httpclient.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question