Note that there are some explanatory texts on larger screens.

plurals
  1. POAFNetworking sumit html form
    primarykey
    data
    text
    <p>I'm learning to use AFNetworking and want to submit login form. </p> <p>My code:</p> <pre><code>NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: @"mymail@yahoo.com",@"login[username]", @"123456", @"login[password]", nil]; NSMutableURLRequest *request = [self requestWithMethod:@"POST" path:@"index.php/customer/account/loginPost/" parameters:params]; [request setValue:@"foo=bar" forHTTPHeaderField:@"Cookie"]; AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"oauthAuthorize Success: %@", [operation.response allHeaderFields]); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"oauthAuthorize Fail: %@",operation.responseString); }]; [self enqueueHTTPRequestOperation:operation]; </code></pre> <p>and the header I recived:</p> <pre><code> "Cache-Control" = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"; Connection = "Keep-Alive"; "Content-Type" = "text/html; charset=UTF-8"; Date = "Wed, 28 Nov 2012 09:57:03 GMT"; Expires = "Thu, 19 Nov 1981 08:52:00 GMT"; "Keep-Alive" = "timeout=5, max=98"; "Login-Required" = true; Pragma = "no-cache"; Server = "Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7"; "Set-Cookie" = "frontend=sq26g7l2j45itg9sk6etf249r7; expires=Wed, 28-Nov-2012 10:57:04 GMT; path=/magento_1702; domain=myhost; HttpOnly"; "Transfer-Encoding" = Identity; "X-Powered-By" = "PHP/5.4.7"; </code></pre> <p>I know I login fail, because when login on Browser, it will redirect to account page if successful. </p> <p>I had test action of this form use bash on MAC and have result:</p> <p>Comand:</p> <pre><code> curl -v -F login[username]=mymai@yahoo.com -F login[password]=123456 --header "Cookie:foo=bar" myhost/mypage/index.php/customer/account/loginPost/ </code></pre> <p>Result:</p> <pre><code> &lt; Server: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 &lt; X-Powered-By: PHP/5.4.7 &lt; Set-Cookie: frontend=ui19hig1g1pu43kdsam43naqr6; expires=Wed, 28-Nov-2012 10:46:21 GMT; path=/magento_1702; domain=myhost; HttpOnly &lt; Expires: Thu, 19 Nov 1981 08:52:00 GMT &lt; Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 &lt; Pragma: no-cache &lt; Set-Cookie: persistent_shopping_cart=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/magento_1702; domain=192.168.1.254; httponly &lt; Set-Cookie: frontend=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/magento_1702; domain=192.168.1.254; httponly &lt; Set-Cookie: frontend=aaqja98lg13v6pc1qgema98i40; expires=Wed, 28-Nov-2012 10:46:22 GMT; path=/magento_1702; domain=192.168.1.254; HttpOnly &lt; Location: http://myhost/magento_1702/index.php/customer/account/ &lt; Content-Length: 0 &lt; Content-Type: text/html; charset=UTF-8 </code></pre> <p>The header has Location field is url of account page and doesn't have Login-Required field. I think it login success.</p> <p>Please explain me how to use AFNetwoking to login success like using Bash command? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload