我正在嘗試使用xcode創建登錄頁面。使用iphone應用程序登錄
我已經閱讀了關於此的所有主題,並且我非常確定我的應用程序會將用戶名和密碼以 的密碼成功發送到網頁。
但我的問題是,當我打電話給一個響應字符串時,我仍然從網頁上的登錄屏幕獲得源代碼 。 當我的應用程序發送密碼和用戶名時,我該從哪裏出發?
我使用ASIformdatarequest POST用戶名和密碼。
這裏我的代碼,我發送的用戶名和密碼
(Brugernavn =用戶名和Adgangskode =密碼)
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://coutbound.dk/login.asp"]];
[request setPostValue:[self.bnavn text] forKey:@"Brugernavn"];
[request setPostValue:[self.kord text] forKey:@"Adgangskode"];
[request setDelegate:self];
[request startAsynchronous];
}
- (void)requestFailed:(ASIHTTPRequest *)request {
NSLog(@"Request failed: %@",[request error]);
}
- (void)requestFinished:(ASIHTTPRequest *)request {
NSLog(@"Submitted form successfully");
NSLog(@"Response was:");
NSLog(@"%@",[request responseString]);
}
以及網頁
<html>
<head>
<title>Login script</title>
<link rel=stylesheet title=std href="typografi.css" type="text/css">
</head>
<body style="background-color: transparent;">
<img border="0" src="aeble.gif" width="161" height="120">
<form method="POST" action="login.asp">
<table border="0" width="100%" height="2">
<tr>
<td width="41%" height="1">
<p align="left"><script language="JavaScript">
day = new Date()
hr = day.getHours()
if (hr < 5)
hilsen = "God aften"
if (hr >= 5)
hilsen = "God morgen"
if (hr >= 10)
hilsen = "God formiddag"
if (hr >= 12)
hilsen = "God eftermiddag"
if (hr >= 17)
hilsen = "God aften"
document.write(hilsen)
</script> og velkommen<script>
today = new Date();
document.write(' på COutbound i dag den '+today.getDate()+'. ')
tmonth = today.getMonth()
if (tmonth==0) document.write('januar ')
if (tmonth==1) document.write('februar ')
if (tmonth==2) document.write('marts ')
if (tmonth==3) document.write('april ')
if (tmonth==4) document.write('maj ')
if (tmonth==5) document.write('juni ')
if (tmonth==6) document.write('juli ')
if (tmonth==7) document.write('august ')
if (tmonth==8) document.write('september ')
if (tmonth==9) document.write('oktober ')
if (tmonth==10) document.write('november ')
if (tmonth==11) document.write('december ')
document.write(today.getUTCFullYear())
document.write('<br>')
s = 'December 24, '
if (today.getMonth()==11)
if (today.getDate()>24) {
if (today.getYear()<100)
s += today.getYear() + 1901
else s += today.getYear() +1
}
else s += today.getYear()
if (today.getMonth()==11)
if (today.getDate()==24)
document.write('<font size=+2>så idag er det Juleaften</font>')
else {
BigDay = new Date(s)
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = (timeLeft/msPerDay)+1;
daysLeft = Math.floor (e_daysLeft);
document.write('der er '+daysLeft+' dage til Juleaften i ');
if (BigDay.getYear()<100)
document.write(BigDay.getYear()+1900)
else document.write(BigDay.getYear())
document.write('</font><p>')
}
</script></p>
<p style="margin: 0">Angiv brugernavn og adgangskode herunder. Har du ikke brugernavn og adgangskode skal du oprette dig som bruger
ved at klikke på linket under formularen!
</tr>
</table>
<table border="0" width="45%" height="47">
<tr>
<td width="50%" height="26">Brugernavn:</td>
<td width="50%" height="26"><input type="text" name="Brugernavn" size="25"></td>
</tr>
<tr>
<td height="26">Adgangskode:</td>
<td height="26"><input type="password" name="Adgangskode" size="25"></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><input type="submit" value="Login" name="Action" style="font-size: 8pt"></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2" height="25" valign="bottom"><a href="Login2.asp">Opret ny bruger</a>  <a href="forgotp.asp">Jeg har glemt mit kodeord</a></td>
</tr>
</table>
</form>
</body>
</html>
解決方案
我解決了我的專業瑕疵做一個帖子的按鈕「行動」與價值「登錄」
發表一些代碼。您的描述過於籠統,不能讓我們來幫助您。 – onnoweb
NSURLConnection將允許您對網站或Web服務進行簡單的POST。但發佈一些代碼,以便我們可以看到你已經嘗試過。 – Popeye
這裏是代碼:) –