私はIOSのスケジュールを立てており、PHPの関数にパラメーターを送信することに疑いがあるため、Java / Androidの初心者です。
ユーザーが送信をクリックすると、フォームの内容が文字列に保存されます。
最後に文字列 4 がある
名前 電子メール nameUser EmailUser
それらをphpで機能させるために送信する必要があります。このチュートリアルに従いました:
しかし、私の問題は、文字列の値を関数のパラメーターとして持つことです
IOS で次のことを行いました。
....
NSString *urlEnvio = [[NSString alloc] initWithFormat:@"http://www.xxxx.com.br/indicar.php?destinatario=%@&remetente=%@&nomedestinatario=%@&nome=%@&enviar=%@", destinatario, remetente, nome,nomeRemetente, check];
...
Javaが必要なものです。
リクエストに応じて、投稿を編集しました.....
@Override
public void onClick(View v) {
String nome = seuNome.getText().toString();
String email = seuEmail.getText().toString();
String strNomeAmigo = nomeAmigo.getText().toString();
String strEmailAmigo = emailAmigo.getText().toString();
//chama funcao que envia
indicar();
}
});
}
public void indicar(){
new Thread(new Runnable() {
public void run() {
BufferedReader in = null;
try {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet();
request.setURI(new URI("http://www.xxxx.com.br/indicar.php?"));
//send to this address with the parameters: name, email, strNomeAmigo, strEmailAmigo
//
HttpResponse response = client.execute(request);
in = new BufferedReader
(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");
while ((line = in.readLine()) != null) {
sb.append(line + NL);
}
in.close();
String page = sb.toString();
System.out.println(page);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
}).start();
}
....
name、email、strNomeAmigo、strEmailAmigo のパラメーターを使用して、このアドレスに送信します。
このようなもの: http://www.xxxxx.com.br/indicar.php?nome=name_example&email=example@example.com ......