I have a php file, the class name is YoutubeToMp3.It has a function named as "get".It works truely.When i want to print it's result in server I do it like this
echo YoutubeToMP3::get('https://www.youtube.com/watch?v=sEhy-RXkNo0', YoutubeToMP3::LINK);
The problem is i want to send data from android to php in server and call the function "get" with using sent data from android and send back the "get" function's return data to android.For example in android i send data named url.As below
public void postData(String toPost) {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.URL.com/yourpage.php");
//This is the data to send
String url = 'https://www.youtube.com/watch?v=sEhy-RXkNo0'; //any data to send
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("action", url));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String response = httpclient.execute(httppost, responseHandler);
//This is the response from a php application
String reverseString = response;
Toast.makeText(this, "response" + reverseString, Toast.LENGTH_LONG).show();
} catch (ClientProtocolException e) {
Toast.makeText(this, "CPE response " + e.toString(), Toast.LENGTH_LONG).show();
// TODO Auto-generated catch block
} catch (IOException e) {
Toast.makeText(this, "IOE response " + e.toString(), Toast.LENGTH_LONG).show();
// TODO Auto-generated catch block
}
}//end postData()
And i want to use function in server like this
YoutubeToMP3::get(url, YoutubeToMP3::LINK);
Clearly i wanna tell you this: i sent data to server but in server how can i take this data and use it with get function and send back the data to android? Thanks ind advance. Any help would be appreciated. Note: i want to run this php files in wordpress.