dongnanbi4942
dongnanbi4942
2011-04-20 10:55

如何将数据从iphone发送/存储到mysql数据库并在网页上显示结果

basically I have an application which records the user's locations(the longitude and longitude) using corelocation and stores the data to a core data model. I wish to know how I can use an UIbutton to send that location data to a local MYSQL database and display the results on a webpage using php maybe?

I'm not quite sure how to do the php scripts etc, any help, tuts or examples would be much appreciated!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • douzheng1853 douzheng1853 10年前

    I don't know iPhone at all but I was implementing an Android app that did the same thing - record GPS coords and send them to the webserver.

    It was all done through SOAP webservices - from Android (Your iPhone) connect to the webservice, choose proper method and use it to send the data to the webservice. The webservice (that has to be written) then gets the data, parses it and stores to the database so the data could be presented on the webpage...

    You also can use REST webservices that are simpler to implement and also the comunication with it is simpler.

    点赞 评论 复制链接分享
  • duanou9739 duanou9739 10年前

    I think the answer should be split in 2 -

    Sending the data to the server:

    You can open direct TCP connections like discussed here Connecting iPhone to an ODBC Database and here http://www.iphonedevsdk.com/forum/iphone-sdk-development/3942-retrieve-information-sql-server.html

    And you can do as @Jhaliya suggested and utilize some web service or REST API. I used Web Services (which I understand are a losing horse), but with this site - http://sudzc.com - it was incredibly easy to utilize. You just give the description of the web service, and get objective-c classes to use (wrapping behing the scenes encoding, sending,receiving,decoding etc.).

    Showing the data:

    There are several free platforms for PHP showing graphs for a database. Some of them have better GUI, some have support for a minimal mobile UI, and more. I happened to use:

    Art - http://art.sourceforge.net/

    Jasper Reports - http://jasperforge.org/projects/jasperreports

    And I'm sure there's more... You can search for "sql web reporting" and perhaps add "open source"...

    HTH!

    Oded

    点赞 评论 复制链接分享