Reputation: 2111
I have an aplication wich I use to register some items. I want to store thoose at an online database, for that matter I created a simple php page that receives the variables via URL and adds them to a database. I can get things working swiftly by calling the browser intent and opening the URL, but thats kind of boring. Is there any other way to call my URL without opening the browser and still run the php code?
Upvotes: 2
Views: 6576
Reputation: 5729
Yes, you could do it by choosing any one of following options among multiple options available. All below option will mock browser behavior and eventually execute call your PHP service.
Upvotes: 0
Reputation: 3801
It would be a web service call, see this thread... How to call a SOAP web service on Android
Technically, any time you call a web url to do something (ex: a simple php page that receives the variables via URL and adds them to a database) its a web service. Now in your case its likely it does not use SOAP and have a WSDL, but its more of a RESTful type setup, in which you post the data and it processes it.
HttpClient httpClient = new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
HttpGet httpGet = new HttpGet("http://www.example.com/" + URL);
response = httpClient.execute(httpGet, localContext);
Upvotes: 4