title: How to send HTTP requests in Swift 4?
body: <p>Did anything change in Swift 4? In swift 3 i used this code</p>
  
  <pre><code>    var request = URLRequest(url: URL(string: "http://www.centill.website/ajax/logreg.php")!)
      request.httpMethod = "POST"
      let postString = "ko=1231a"
      request.httpBody = postString.data(using: .utf8)
      let task = URLSession.shared.dataTask(with: request) { data, response, error in
          guard let data = data, error == nil else {                                                 // check for fundamental networking error
              print("error=\(error)")
              return
          }
  
          if let httpStatus = response as? HTTPURLResponse, httpStatus.statusCode != 200 {           // check for http errors
              print("statusCode should be 200, but is \(httpStatus.statusCode)")
              print(response)
          }
  
          let responseString = String(data: data, encoding: .utf8)
          print(responseString)
      }
      task.resume()
  </code></pre>
  
  <p>i wonder if they did any improvements or added anything new.</p>