我正在申请通过betamax向VOIP提供商发送短信。
要发送短信我只需要执行网址
https://www.12voip.com/myaccount/sendsms.php?username=w&password=x&from=y&to=z&text=some%20text
我的应用已经创建了网址,但我无法理解如何执行。我想我必须为此发出一个http请求。但我完全不明白。
任何人都可以帮我执行android的url吗?
答案 0 :(得分:8)
Android包含org.apache.http
包中的Apache Http Components。在那里,您将找到调用带参数的URL所需的一切。
在这里,您将找到客户端教程:http://hc.apache.org/httpcomponents-client/tutorial/html/
你需要做这样的事情:
HttpClient client = new DefaultHttpClient();
)HttpGet req = new HttpGet("url-without-params");
)req.setParams(params);
)HttpResponse res = client.executeMethod(req);
)res.getStatusLine().getStatusCode();
)答案 1 :(得分:0)
我不是100%确定你要做什么,但答案是使用Apache Http Client which is included in android。