[英]Make HTTP Get request in iOS with params
I want to make an HTTP GET request from my iOS client and place in the request params. 我想从我的iOS客户端发出HTTP GET请求并将其放置在请求参数中。 I have written code that performs a POST request, where it was very easy to use setHTTPBody to place a NSData* object in the request.
我已经编写了执行POST请求的代码,使用setHTTPBody在请求中放置NSData *对象非常容易。 How is this done for a GET request?
如何处理GET请求?
Thanks 谢谢
In a GET method the parameters are passed in the query string - so you suffix your URL with something like ?param1=value1¶m2=value2¶m3=value3. 在GET方法中,参数是在查询字符串中传递的-因此您可以在URL的后缀?param1 = value1&param2 = value2&param3 = value3。 You may need to percent-encode your query string if it contains characters like space, & or =
如果查询字符串包含空格,&或=之类的字符,则可能需要对其进行百分比编码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.