I want to execute the php url from android and pass the two values while executing the url.
Here is the code I use. I used GET
method but I need to send it as POST variable.
How can I change the request from GET
variable to POST
variable in the below code:
public class AsyncTaskOperation extends AsyncTask <String, Void, Void>
{
@Override
protected Void doInBackground(String... paramsObj)
{
//Sending the php file path
String php_send="http://localhost/tested/test/copy_fiel.php?Cus="+Cus+"&"+"Cut_fol="+Cut_fol;
System.out.println(php_send);
// want to execute the above path using Http client but it is not working
HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(php_send);
try {
HttpResponse resp = client.execute(httpGet);
System.out.println(resp);
}
catch(Exception e) {
e.printStackTrace();
}
return null;
}
}