Created
May 21, 2010 03:56
-
-
Save BlairDuncan/408438 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(CPURLRequest)createFindRequestWithIdentifier:(BOOL)useIndentifier | |
{ | |
var userID = [userID_TextField stringValue]; | |
var userPW = [userPW_TextField stringValue]; | |
var content = [[CPString alloc] initWithFormat:@"userID=%@&userPW=%@", | |
[userID urlencode], | |
[userPW urlencode]]; | |
var contentLength = [[CPString alloc] initWithFormat:@"%d", [content length]]; | |
var request = [[CPURLRequest alloc] initWithURL:@"http://torxserve01.bbdo.ca/sgl/devCappuccino/sgl/php/JSON_loginDev.php"]; | |
[request setHTTPMethod:@"POST"]; | |
[request setHTTPBody:content]; | |
[request setValue:contentLength forHTTPHeaderField:@"Content-Length"]; | |
[request setValue:"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; | |
if (useIndentifier) | |
{ | |
var serviceUser = userID, | |
servicePassword = userPW, | |
secret = [[CPString stringWithFormat:@"%@:%@", serviceUser, servicePassword] encodeBase64], | |
authorization = [CPString stringWithFormat:@"Basic %@", secret]; | |
[request setValue:authorization forHTTPHeaderField:@"Authorization"]; | |
} | |
return request; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment