简体   繁体   English

使用alamofire和Swift4 IOS获取XML HTTP url的响应

[英]Get Response of XML HTTP url using alamofire and Swift4 IOS

I am developing an application in which I need to get the response code of a HTTP URL, The URL returns an xml which is encrypted. 我正在开发一个需要获取HTTP URL响应代码的应用程序,该URL返回经过加密的xml。 I only need to get that encrypted response code into a variable. 我只需要将加密的响应代码放入变量中即可。 I've used Alamofire for http request. 我已经将Alamofire用于http请求。

Thanks in advance! 提前致谢!

Alamofire.request("URL Goes here",method:.get)
 .response { response in
    if let data = response.data {
      print(data)
      var xml = SWXMLHash.parse(data)
      print(xml["e1"]["e2"].element?.text)
    }
 }

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

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