Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javatest;
- import java.io.Console;
- import java.util.logging.ConsoleHandler;
- import java.net.HttpURLConnection;
- import java.net.URL;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.DataInputStream;
- import java.net.MalformedURLException;
- import java.io.BufferedInputStream;
- public class Javatest {
- public static void main(String[] args) {
- /*try {
- URL url = new URL("192.168.1.190/index.php");
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.addRequestProperty("ok", "yes");
- connection.setDoOutput(true);
- connection.setInstanceFollowRedirects(false);
- connection.setRequestMethod("GET");
- connection.setRequestProperty("Content-Type", "text/plain");
- connection.setRequestProperty("charset", "utf-8");
- connection.connect();
- System.out.println("OK");
- } catch (IOException e) {
- System.out.println("FUCK");
- }*/
- String user = p.getName();
- String email = args[0].toString();
- String pass = args[1].toString();
- String urlParameters = "u=" + user + "&e=" + email + "&p=" + pass;
- String request = "http://localhost/uhc/post.php?";
- URL url = new URL(request + urlParameters);
- InputStream is = null;
- DataInputStream dis;
- String line;
- try {
- url = new URL("http://192.168.1.190/");
- is = url.openStream(); // throws an IOException
- dis = new DataInputStream(new BufferedInputStream(is));
- /* !READ
- while ((line = dis.readLine()) != null) {
- System.out.println(line);
- }
- */
- } catch (MalformedURLException mue) {
- mue.printStackTrace();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- } finally {
- try {
- is.close();
- } catch (IOException ioe) {
- // nothing to see here
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement