M
MartinYAY
Gast
Hi,
braucht der Client(Java) Schreibrechte für eine PHP Datei, die er aufruft und an der er per POST was schickt um es dann zurück zu empfangen?
Zum test, habe ich eine PHP Datei mit folgendem Inhalt verwendet:
<?php
if(strtolower($_SERVER['REQUEST_METHOD']) == 'post')
{
$keysPOST = count($_POST, COUNT_NORMAL);
for($i = 0; count($_POST, COUNT_RECURSIVE) < $i; $i++)
{
echo $keysPOST[$i] . ' = ' . $_POST[$keysPost[$i]] . '\n';
}
}
?>
Gesendet wird per OutputStream. Es wird aper voher noch in Bytes gewandelt. Empfangen wird per InputStream. Dazu der Code:
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();
}
Problem ist, das dass was ankommt ein String sein soll aber es kommt nur ein leeres Quadrat als Zeichen an.
braucht der Client(Java) Schreibrechte für eine PHP Datei, die er aufruft und an der er per POST was schickt um es dann zurück zu empfangen?
Zum test, habe ich eine PHP Datei mit folgendem Inhalt verwendet:
<?php
if(strtolower($_SERVER['REQUEST_METHOD']) == 'post')
{
$keysPOST = count($_POST, COUNT_NORMAL);
for($i = 0; count($_POST, COUNT_RECURSIVE) < $i; $i++)
{
echo $keysPOST[$i] . ' = ' . $_POST[$keysPost[$i]] . '\n';
}
}
?>
Gesendet wird per OutputStream. Es wird aper voher noch in Bytes gewandelt. Empfangen wird per InputStream. Dazu der Code:
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();
}
Problem ist, das dass was ankommt ein String sein soll aber es kommt nur ein leeres Quadrat als Zeichen an.