V
vidhi
hi,
i m making an applet which redirects my page to a php page on which i
wish to send some information by using HTTP POST; but i faces problem
while doing this, the get posted but information dose'nt.
code which i use is
import javax.swing.*;
import java.net.*;
import java.io.*;
public class MyApplet extends JApplet
{
public void init()
{
URL url=null;
try{
url=new URL("http://192.168.5.22/java_scan/Mp3Project/server.php");
}catch(MalformedURLException me){}
try{
HttpURLConnection
connection=(HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
PrintWriter out = new PrintWriter(connection.getOutputStream());
out.println("Name=vidhi\r\n");
out.close();
}catch(IOException ie){}
getAppletContext().showDocument(url);
}
}
And the code for PHP on which i m listning is
<?php
print <<<EOM
<html>
<body>
$_POST[Name]
</body>
</html>
EOM
;
?>
plese help me to rectify the problem
i m making an applet which redirects my page to a php page on which i
wish to send some information by using HTTP POST; but i faces problem
while doing this, the get posted but information dose'nt.
code which i use is
import javax.swing.*;
import java.net.*;
import java.io.*;
public class MyApplet extends JApplet
{
public void init()
{
URL url=null;
try{
url=new URL("http://192.168.5.22/java_scan/Mp3Project/server.php");
}catch(MalformedURLException me){}
try{
HttpURLConnection
connection=(HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
PrintWriter out = new PrintWriter(connection.getOutputStream());
out.println("Name=vidhi\r\n");
out.close();
}catch(IOException ie){}
getAppletContext().showDocument(url);
}
}
And the code for PHP on which i m listning is
<?php
print <<<EOM
<html>
<body>
$_POST[Name]
</body>
</html>
EOM
;
?>
plese help me to rectify the problem