Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PostToPage {
- public static void post(String link, String username, String password){
- try {
- // open a connection to the site
- URL url = new URL(link);
- URLConnection con = url.openConnection();
- // activate the output
- con.setDoOutput(true);
- PrintStream ps = new PrintStream(con.getOutputStream());
- // send your parameters to your site
- ps.print("&Username=" + username);
- ps.print("&Password=" + password);
- // we have to get the input stream in order to actually send the request
- con.getInputStream();
- // close the print stream
- ps.close();
- } catch (MalformedURLException e1) {
- e1.printStackTrace();
- } catch (IOException e2) {
- e2.printStackTrace();
- }
- // creating new product in background thread
- //new CreatePortfolio().execute();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement