|Mar 2, 2009, 04:36 AM||#1|
How to POST url in safari?
I want my app to open url in Safari and to login.
I know how to just open URL:
UIApplication *app = [UIApplication sharedApplication]; [app openURL:[[NSURL alloc] initWithString:@"http://www.somedomain.net"]];
<form action="http://www.somedomain.net/login.php" method="post"> ... <td width="68%"><input name="username" class="formlogin" size="23" type="text" /></td> <td width="10%"> </td> </tr> <tr> <td>Password:</td> <td><input name="pass" class="formlogin" size="23" type="password" /></td>
Well, I know how to POST
NSString *myRequestString = @"username=sampleuser&pass=samplepass"; NSData *myRequestData = [NSData dataWithBytes: [ myRequestString UTF8String ] length: [ myRequestString length ] ]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://somedomain.net/login.php" ]]; [ request setHTTPMethod: @"POST" ]; [ request setHTTPBody: myRequestData ]; NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; [connection release]; [request release];
|Mar 7, 2009, 08:39 PM||#2|
Not sure if I'm on target with this answer. But I thought it was worth mentioning that many applications log into websites through means of a web Service. For instance. You write the code as you have done, and send it to a PHP file or SOAP file which then logs the user in, and can transfer data to databases ect. Just a thought.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|how to disable flash in safari||andiwm2003||Mac Applications and Mac App Store||11||Nov 22, 2011 09:09 AM|
|Applescript to open URL in Safari without titlebar...almost working :-)||max.p||Mac Programming||0||Aug 29, 2010 06:22 PM|
|How To Download Normally in Safari||PYR0M310N||Mac Applications and Mac App Store||4||Feb 18, 2007 12:18 PM|
|How to share bookmarks in Safari/Firefox-Popups||markw10||Mac Applications and Mac App Store||1||Nov 1, 2006 08:11 AM|
|How to download non-links in Safari?||boybenjamin||Mac Applications and Mac App Store||3||Sep 7, 2003 10:38 PM|
All times are GMT -5. The time now is 12:52 AM.