For example, you can use the get request '{code...}' and then use the php background to accept the data sent by the android client.
For example, use get request'
public class MainActivity extends Activity {private EditText name;private EditText age;@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); name=(EditText) findViewById(R.id.editText1); age=(EditText) findViewById(R.id.editText2); Button regist= (Button) findViewById(R.id.button1); regist.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String url="http://testshitou.sinaapp.com/http.php"; url=url+"?name="+name.getText().toString()+"&age="+age.getText().toString(); new HttpClentThread(url).start(); }});}
}
`
Then how does the php background accept the data sent from the android client?
Reply content:
For example, use get request'
public class MainActivity extends Activity {private EditText name;private EditText age;@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); name=(EditText) findViewById(R.id.editText1); age=(EditText) findViewById(R.id.editText2); Button regist= (Button) findViewById(R.id.button1); regist.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String url="http://testshitou.sinaapp.com/http.php"; url=url+"?name="+name.getText().toString()+"&age="+age.getText().toString(); new HttpClentThread(url).start(); }});}
}
`
Then how does the php background accept the data sent from the android client?
Although you do not know whether you are writing an APP or a server, the get post request is platform-independent.
Backend interfaces written in Python, C ++, PHP, and Java can directly send requests to the server.
Whether it is Android, Web, OS X App, or iOS App, the client can send requests to the server.
The background get post Reception has nothing to do with the android client. You can only get post in the background. The client knows how to do the rest, whether it is Android, iOS or WP.
The question should be changedHow php receives get/pos parameters sent by the clientIt has nothing to do with android. Enter in the browserHttp://testshitou.sinaapp.com/http.php? Name = My name & age = 18Is equivalent to a get request.
For example, to receive the name parameter_GET['name']Or_POST['name']You can get