Skip to content

Instantly share code, notes, and snippets.

<?php
// this script was created by Akbar Taufiq Herlangga (Software Engineer at Qiscus)
// this script was created for the Qiscus TechTalk #35 - Build Your Own MVC Framework
//////////////////////////////////////////////////////////////////////
//////////////////////////// M O D E L ///////////////////////////////
NSURL *url = [NSURL URLWithString:@"http://localhost:3000/users/sign_in.json"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
NSString *postString = @"user[email][email protected]&user[password]=halo123123";
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSString *status = [JSON valueForKeyPath:@"success"];
NSLog(@"status = %@", status);