0
我在寫iOS應用程序。 有一個服務器相關的一些房地產。 我必須發送以下請求到服務器以獲取Nonce。iOS - NSURLConnection - 連接服務器並獲得隨機數
GET /ptest/login HTTP/1.1
Method: GET
User-Agent: MRIS API
Testing Tool/2.0
Rets-Version: RETS/1.7
Accept: */*
Host: ptest.mris.com:6103
Connection: keep-alive
我使用ASI HTTP與下面的代碼發佈:
[self setRequest:[ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"/ptest/login"]]];
[request addRequestHeader:@"User-Agent" value:@"CARETS-General/1.0"];
[request addRequestHeader:@"Rets-Version" value:@"1.7"];
[request addRequestHeader:@"Connection" value:@"keep-alive"];
[request addRequestHeader:@"Accept" value:@"*/*"];
[request addRequestHeader:@"Host" value:"ptest.mris.com:6103"];
[request setDelegate:self];
[request setDidFinishSelector:@selector(topSecretFetchComplete:)];
[request setDidFailSelector:@selector(topSecretFetchFailed:)];
[request startAsynchronous];
是我得到的響應
錯誤:無法啓動HTTP連接
可不可以有一個人指出我如何建立成功的連接?
你確定url [NSURL URLWithString:@「/ ptest/login」]正在工作嗎? (任何域?) – beryllium
是的,我試圖在瀏覽器中打開它,它的響應 – Satyam