将iPhone HTTP请求发送到Apache PHP Web服务器 [英] Send iPhone HTTP request to Apache PHP webserver

查看:210
本文介绍了将iPhone HTTP请求发送到Apache PHP Web服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是程序员,拥有游戏和3D图形背景,目前我想了解我的网络和网络开发技巧。

I am programmer with a games and 3D graphics background and at the moment I would like to brush up on my networking and web development skills.

我有一项任务我想完成这件事。我的想法是,我希望能够发送HTTP请求或类似于我的网络服务器,它运行基于LAMP的设置。我想知道如何使用Cocoa Touch框架将包含一些信息的HTTP请求发送到我的网络服务器。

I have a task that I would like to accomplish to do this. My idea is that I would like to be able to send a HTTP request or something similar to my webserver, which runs a LAMP based setup. I would like to know how I can send a HTTP request containing some information from my iPhone using the Cocoa Touch framework, to my webserver.

我想要网络服务器(使用PHP)能够将发送的信息记录到纯文本文件中,以后我可以用它来制作图表。对于我的例子,我们可以发送当前日期。

I would like the webserver (using PHP) to be able to record the sent information into a plain text file, that I can use later to make graphs. For my example we could just send the current date.

我认为人们必须经常这样做,我真的想知道如何做到这一点。谢谢你的帮助。

I think that people must do this very often and I really want to know how to do this. Thanks for your help.

P.S。如果您不知道Cocoa代码以便发送请求,那没关系我确定我可以解决这个问题,但我想至少知道如何让Linux服务器保存HTTP请求,最好是PHP但另一种合适的语言是好的。奖励标记为此安全

P.S. If you don't know the Cocoa code in order to send the request, that's okay I'm sure I can figure that out, but I would like to at least know how to get the Linux server to save the HTTP request, preferrably PHP but another appropriate language is fine. Bonus marks for away to do this securely.

另外:我是一个总的菜鸟,需要源代码,欢呼:D

Also: I am a total noob at this and require source code, cheers :D

推荐答案

你真的无法通过像 ASIHTTPRequest 。文档非常好,涵盖了所有重要主题,如:

You really can't go past a library like ASIHTTPRequest if you need to make HTTP requests from an iPhone or Mac client to a web server. The documentation is very good, and covers all the important topics like:


  • 异步与同步请求

  • 将数据发送到服务器

  • 跟踪上传/下载进度

  • 处理身份验证

  • 使用钥匙串存储凭证

  • 使用gzip压缩请求正文

  • asynchronous vs synchronous requests
  • sending data to the server
  • tracking upload/download progress
  • handling authentication
  • using the keychain for storage of credentials
  • compressing request bodies with gzip

您应该查看 - 它将让您的生活更轻松。

You should check it out -- it will make your life much easier.

这篇关于将iPhone HTTP请求发送到Apache PHP Web服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆