Hallo
ich habe ein applet welches über php Datein mit einer Datenbank kommuniziert. Das Applet funktioniert im Firefox, IE ohne Problem aber im Opera-Browser funktioniert es nicht.
Ich kommuniziere so mit den php Datein:
in der php Datei kommen die Variablenwerte aber nicht an! jedenfalls mit dem Opera.
Ich benutze die folgende Klasse als Schnittstelle
Kann mir einer sagen wo der Fehler liegen könnte??
Danke
ich habe ein applet welches über php Datein mit einer Datenbank kommuniziert. Das Applet funktioniert im Firefox, IE ohne Problem aber im Opera-Browser funktioniert es nicht.
Ich kommuniziere so mit den php Datein:
Code:
URL url = new URL(SettingsS.getInstanz().getMyHost()+"checkData.php");
PhpPostConnect con = new PhpPostConnect(url);
con.send("user=" +
SettingsS.getInstanz().getUser() +
"&password=" +
SettingsS.getInstanz().getPassword() +
"&codew=" +
SettingsS.getInstanz().getCodew());
String read = con.read();
in der php Datei kommen die Variablenwerte aber nicht an! jedenfalls mit dem Opera.
Ich benutze die folgende Klasse als Schnittstelle
Code:
package GUI;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
/**
* PhpPostConnect.java
* This class can represant a connection to an PHP-Site
* to send the side data via "POST" and get Data from
* the side which will be written by side with "echo"
* @author sparrow
*/
public class PhpPostConnect {
/** Contains the URL to the PHP-Script */
private URL sitepath;
/** The Connection to the URL */
private URLConnection con;
/**
* Empty construct, you must set the URL of the
* target before you start to send and read data
*/
public PhpPostConnect()
{
}
/**
* Construct which also define the targed URL
* @param sitepath The URL to the target PHP-Script
*/
public PhpPostConnect(URL sitepath) {
this.sitepath = sitepath;
}
/**
* Set the URL to the target PHP-Script
* @param sitepath The URL to the target PHP-Script
*/
public void setSitePath(URL sitepath) {
this.sitepath = sitepath;
}
/**
* To get the target-URL
* @return The URL to the target PHP-Script
*/
public URL getSitePath() {
return this.sitepath;
}
/**
* Sending data to the target-URL
* @param data The data which should be send
* @throws IOException
*/
public void send(String data) throws IOException {
if (con == null) {
con = sitepath.openConnection();
}
if (con.getDoOutput() == false) {
con.setDoOutput(true);
}
OutputStream out = con.getOutputStream();
out.write(data.getBytes());
out.flush();
}
/**
* Reading incoming data from the target-URL
* @return The incoming data
* @throws IOException
*/
public String read() throws IOException {
if (con == null) {
con = sitepath.openConnection();
}
InputStream in = con.getInputStream();
int c = 0;
StringBuffer incoming = new StringBuffer();
while (c >= 0) {
c = in.read();
incoming.append((char) c);
}
return incoming.toString();
}
}
Kann mir einer sagen wo der Fehler liegen könnte??
Danke