我正在申请通过betamax向VOIP提供商发送短信.
要发送短信我只需要执行网址
https://www.12voip.com/myaccount/sendsms.php?username=w?&password=x&from=y&to=z&text=some%20text
Run Code Online (Sandbox Code Playgroud)
我的应用已经创建了URL,但我无法理解如何执行.我想我必须为此发出一个http请求.但我完全不明白.
谁能帮助我用android执行url?
安卓包含Apache的HTTP组件封装org.apache.http.在那里,您将找到使用参数调用URL所需的一切.
在这里,您将找到客户端教程:http://hc.apache.org/httpcomponents-client/tutorial/html/
你需要做这样的事情:
HttpClient client = new DefaultHttpClient();)HttpGet req = new HttpGet("url-without-params");)的GET方法req.setParams(params);)添加参数HttpResponse res = client.executeMethod(req);)执行方法res.getStatusLine().getStatusCode();)祝好运!
| 归档时间: |
|
| 查看次数: |
5539 次 |
| 最近记录: |