开发者

ASIFormDataRequest POST returning website source code?

开发者 https://www.devze.com 2023-02-15 11:44 出处:网络
I am using the following code to set the username and password to a form on a website: ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];

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.


This is likely a server-side issue or a logic error. In addition to responseString, look at responseHeaders and responseStatusCode to make sure you're getting what you expect.

0

精彩评论

暂无评论...
验证码 换一张
取 消