ASIFormDataRequest POST 返回网站源代码?
我正在使用以下代码将用户名和密码设置为网站上的表单:
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];
[request setRequestMethod:@"POST"];
[request setPostValue:[[NSUserDefaults standardUserDefaults] objectForKey:kUsername] forKey:@"username"];
[request setPostValue:[[NSUserDefaults standardUserDefaults] objectForKey:kPassword] forKey:@"password"];
[request setTimeOutSeconds:40];
[request setDelegate:self];
[request startAsynchronous];
但是我正在 NSLogging 此请求中的responseString,它只是打印出网站的源代码而不是任何信息。
I am using the following code to set the username and password to a form on a website:
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];
[request setRequestMethod:@"POST"];
[request setPostValue:[[NSUserDefaults standardUserDefaults] objectForKey:kUsername] forKey:@"username"];
[request setPostValue:[[NSUserDefaults standardUserDefaults] objectForKey:kPassword] forKey:@"password"];
[request setTimeOutSeconds:40];
[request setDelegate:self];
[request startAsynchronous];
However I am NSLogging the responseString from this request, and it is just printing out the source code of the website rather than any information.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能是服务器端问题或逻辑错误。除了
responseString
之外,还请查看responseHeaders
和responseStatusCode
以确保您获得了预期的结果。This is likely a server-side issue or a logic error. In addition to
responseString
, look atresponseHeaders
andresponseStatusCode
to make sure you're getting what you expect.