Jump to content

Recommended Posts


Posted

I think I have found it....

It's a code to pass Data to PHP using "POST" method

URL myURL=null;
URLConnection urlConn=null;
DataOutputStream printout=null;
DataInputStream input=null;
try{
url=new URL(getCodeBase(),"Picks/"+"writeToFile.php");
}catch(Exception easidghih){}
try{
urlConn=myURL.openConnection();
}catch(Exception w){JOptionPane.showMessageDialog(null,"openConnection() error");}
try{
                    urlConn.setDoInput(true);    urlConn.setUseCaches(false);
}//end of try
catch(Exception a){JOptionPane.showMessageDialog(null,"Exception here");}
try{
printout=new DataOutputStream(urlConn.getOutputStream());
String content="File="+URLEncoder.encode(username+".txt","UTF-8")+"&text="+URLEncoder.encode(Long.toString(number),"UTF-8");
printout.writeBytes(content);
printout.flush();
printout.close();
}//end of try
catch(Exception f){JOptionPane.showMessageDialog(null,"error 2");}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...