发送的LatLong到服务器

编程入门 行业动态 更新时间:2024-10-25 06:24:26
本文介绍了发送的LatLong到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经创建了需要发送接收到的纬度龙到服务器并将其存储在我的数据库纬度龙的应用程序。请建议我如何发送经纬度长到服务器。

I've created a Lat-Long application that needs to send the received Lat-Long to a server and store it in my database. Please suggest me how to send lat-long to server.

推荐答案

如果你正在使用MySQL,你可以使用接收lat和长为参数的PHP脚本,并将其解析到查询..

If you are using MySQL, you can use a php script which receive lat and long as parameters and parse them to the query..

ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("lat", lat)); nameValuePairs.add(new BasicNameValuePair("lng", lng)); try { HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("yourserver/script.php"); httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpClient.execute(httpPost); HttpEntity entity = response.getEntity(); is = entity.getContent(); }catch (Exception e) { // TODO: handle exception Log.e("log_tag", e.toString()); return false; //Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show(); }

更多推荐

发送的LatLong到服务器

本文发布于:2023-11-27 09:02:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637410.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器   LatLong

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!