Hi,
i have some issues to get the values result of a CGI request GET from a camera device.
actually in safari when I paste the local link to my camera with this http request :
://X.X.X.X/cgi-bin/modelreqcgi?action=get
I get this result in safari :
version=1.1.8;model=cbv4pro;
so now I want to get the result and theses fields with her values, but unfortunately with my URL request I never see the values.
please see below my code :
is there anybody who can help me please ??
best regards
i have some issues to get the values result of a CGI request GET from a camera device.
actually in safari when I paste the local link to my camera with this http request :
://X.X.X.X/cgi-bin/modelreqcgi?action=get
I get this result in safari :
version=1.1.8;model=cbv4pro;
so now I want to get the result and theses fields with her values, but unfortunately with my URL request I never see the values.
please see below my code :
Code Block language struct ResponseScan: Decodable { let versionScan: String let modelScan: String }
Code Block language import UIKit class ViewController: UIViewController { @IBOutlet weak var messageLabel: UILabel! @IBOutlet weak var UpdateProgress: UIProgressView! @IBOutlet weak var Radar: UIButton! @IBOutlet var UpdateProgressCollection: [UIProgressView]! //:: Action sur le bouton Scan ::// @IBAction func RadarScan(_ sender: Any) { let urlScanType = "http://192.168.2.1/cgi-bin/model_req_cgi?action=get" if let urlScan = URL (string: urlScanType) { var requestScan = URLRequest (url: urlScan) requestScan.httpMethod = "GET" URLSession.shared.dataTask(with: requestScan) { data, response, error in if let data = data { print("value de data -> \(String.data)") print("value de response -> \(response)") do{ //let jsonData = data.data(using: .utf8)! let decoder = JSONDecoder () let jsonData: ResponseScan = try decoder.decode(ResponseScan.self, from: data) print("Version -> \(jsonData.versionScan)") print("Modèle -> \(jsonData.modelScan)") } catch{} } }.resume() print("Finish !!!!!!!!") } }
is there anybody who can help me please ??
best regards