简体   繁体   English

如何从PHP服务器中的iPhone应用程序接收和处理XML字符串

[英]How to receive and process XML string from iphone app in php server

I am beginner in web development. 我是Web开发的初学者。
I want to get the xml string from the iphone app(not browser) in the php server. 我想从php服务器中的iphone应用程序(不是浏览器)获取xml字符串。
I just read documents about php about how to receive and process data from client sides, but I just get the suggestion like using $_POST to get client data. 我只是阅读了有关如何从客户端接收和处理数据的有关php的文档,但是我只是得到了类似的建议,例如使用$ _POST来获取客户端数据。
However, they just said that $_POST is used to get html form input data from client browser. 但是,他们只是说$ _POST用于从客户端浏览器获取html表单输入数据。
What if it is data from iphone app? 如果是来自iPhone应用程序的数据怎么办? What if the data format is just NSData/NSString that forms the HTTPbody of the iphone POST request? 如果数据格式只是构成iphone POST请求的HTTPbody的NSData / NSString怎么办? What is the technique of doing this? 这样做的技巧是什么?
If okay, can someone give the php code example for me to learn more? 如果可以,有人可以给我提供PHP代码示例以了解更多信息吗?
Thank you so much! 非常感谢!

如果您是这些post ,则可以通过$postdata = file_get_contents("php://input");

If I understand what you're trying to do... 如果我了解您要做什么...

PHP doesn't care from what device or software data was sent. PHP不在乎发送什么设备或软件数据。 (Arguably it has no way of knowing.) PHP will put any valid HTTP POST data into the $_POST variable, regardless if it came from a browser, an iPhone app, or a carrier pidgin. (可能没有办法知道。)PHP会将任何有效的HTTP POST数据放入$ _POST变量,无论它来自浏览器,iPhone应用程序还是运营商pidgin。

In short, if your iPhone app can send your data with an HTTP POST request, PHP will receive it in $_POST. 简而言之,如果您的iPhone应用程序可以通过HTTP POST请求发送数据,则PHP将以$ _POST接收数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM