Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I send a request to different page on the logged site
    primarykey
    data
    text
    <p>First, I want to <strong>connect</strong> to the site.<br> After, I want to <strong>get a data</strong> from different page with this connection </p> <p>sample: </p> <blockquote> <p>1- connect to <strong>http://site.com/Login</strong> with user pass<br> 2- get a secret data from <strong>http://site.com/Secret</strong></p> </blockquote> <p>How do I do this, pleas help me... </p> <pre><code>OutputStreamWriter request = null; url = new URL("http://site.com/Login"); String response = null; EditText user = (EditText)this.findViewById(R.id.user); EditText pass = (EditText)this.findViewById(R.id.pass); String parameters ; try { System.setProperty("http.keepAlive", "true"); url = new URL("http://site.com/Home/Login"); httppost = (HttpURLConnection) url.openConnection(); httppost.setDoInput(true); httppost.setDoOutput(true); httppost.setRequestMethod("POST"); httppost.setRequestProperty("User-Agent", "Mozilla/5.0 Linux U Android 2.3.3 tr-tr HTC_DesireHD_A9191 Build/GRI40 AppleWebKit/533.1 KHTML, like Gecko Version/4.0 Mobile Safari/533.1"); httppost.setRequestProperty("Accept_Language", "en-US"); httppost.setRequestProperty("Connection", "Keep-Alive"); httppost.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); request = new OutputStreamWriter(httppost.getOutputStream()); parameters = "username="+user.getText()+"&amp;password="+pass.getText(); request.write(parameters); request.flush(); request.close(); String line = ""; InputStreamReader isr = new InputStreamReader(httppost.getInputStream()); BufferedReader reader = new BufferedReader(isr); StringBuilder sb = new StringBuilder(); while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } response = sb.toString(); Toast.makeText(this,response, Toast.LENGTH_LONG).show(); isr.close(); reader.close(); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload