override func viewDidLoad() { super.viewDidLoad() let stringUrl = "http://hpscript.com/swift/index.php" let url = URL(string: stringUrl) let request = URLRequest(url: url!) let session = URLSession(configuration: URLSessionConfiguration.default, delegate: nil, delegateQueue: OperationQueue.main) let task:URLSessionDataTask = session.dataTask(with: request, completionHandler: {(data, response, error) in if error != nil { print(error!) return } DispatchQueue.main.async{ } }) task.resume() // Do any additional setup after loading the view, typically from a nib. }