tags:

views:

572

answers:

2

I'm making a App to send SMS trough VOIP providers from betamax...

To send I just need to execute the url

https://www.12voip.com/myaccount/sendsms.php?username=w​&password=x&from=y&to=z&text=some%20text

My app already creates the URL, but i cant understand how to execute...i think i have to make an http request....but after a few hours after answers i still didnt understood....

Can anyone help me execute that url with android?

A: 

I'm not 100% sure of what you are trying to do, but the answer is use the Apache Http Client which is included in android.

Here's the tutorial.

stevedbrown
+2  A: 

Android contains the Apache Http Components in package org.apache.http. There you will find everything you need to call an URL with parameters.

And here you'll find the client tutorial: http://hc.apache.org/httpcomponents-client/tutorial/html/

You need to do something like this:

  1. Create an HttpClient (HttpClient client = new DefaultHttpClient();)
  2. Create a GET-method to URL (HttpGet req = new HttpGet("url-without-params");)
  3. Add parameters to method (req.setParams(params);)
  4. Execute method using client (HttpResponse res = client.executeMethod(req);)
  5. Check response (res.getStatusLine().getStatusCode();)

Good luck!

mafro