Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8054897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:15:02+00:00 2026-06-05T08:15:02+00:00

I’m working on an app that asks the user to login to access some

  • 0

I’m working on an app that asks the user to login to access some of his infrmations. I have a login.php file that is store on the server and all the usernames and passwords on the database.

On my app i have 2 uitextfields one for the username and one for the password. I understand that i can use the POST method to pass on the input to the web server and check wether the username and password match to then load the rest of the data. This is where am having trouble, can anyone help me with it, how do i pass on the inputs from the uitextfield to that web service to run the long.php script?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:15:03+00:00Added an answer on June 5, 2026 at 8:15 am

    Skram’s answer is correct, although you might be thinking what is ASIHTTPRequest?

    You can get the framework here:
    ASIHTTPrequest home

    Here is a short beautiful tutorial on how to use it:
    Awesome Tutorial

    And here is some code I used to do a login some time ago:

      -(IBAction)doLogin{
    
    //make sure you have text in the username field, this is optional
    if(![[username text] isEqualToString:@""]){
        //URL of your web service 
        NSURL *url = [NSURL URLWithString:@"http://localhost:8888/myservice.php"];
        //instantiate request object with URL
        ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
        //Set post values before you send it off (forcing password to lowercase)
        [request setPostValue:[[self.password text] lowercaseString] forKey:@"password"];
        [request setPostValue:[username text] forKey:@"email"];
        //this is optional, I have switch controlling what methods are called in the web service 
        [request setPostValue:@"2" forKey:@"method"];
        //set the delegate to self for ASIHTTPRequest delegates (things you'll see in the tutorial)
        [request setDelegate:self];
        //send out request
        [request startSynchronous];
    
    
        //Now this code handles what happens after the web service call, notice I use a dictionary called user info to hold the response and I check the string to verify pass or fail and act accordingly.
    
        NSString *verify = [NSString stringWithFormat:@"%@",[userinfo objectForKey:@"verify"]];
        if([verify isEqualToString:@"pass"]){
            UIStoryboard *storyboard = [UIStoryboard storyboardWithName:
                                @"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]];
            UITabBarController *mainMenu = 
            [storyboard instantiateViewControllerWithIdentifier:@"mainMenu"];
    
            [self.navigationController pushViewController:mainMenu animated:YES];
        }
        else{
            //show login failed Dialog or something...
        }
    }}
    

    Here some more code, this is what happens when the server returns a response.

    - (void)requestFinished:(ASIHTTPRequest *)request{       
    if (request.responseStatusCode == 400) {
        NSLog(@"Something is wrong");        
    } else if (request.responseStatusCode == 403) {
        NSLog(@"Something is wrong");
    } else if (request.responseStatusCode == 200) {
        //the response code is good so proceed.
        NSString *responseString = [request responseString];
        userinfo = [responseString JSONValue];
            NSLog(@"%@", [userinfo objectForKey:@"id"]);
            NSLog(@"%@", [userinfo objectForKey:@"user"]);
            NSLog(@"%@", [userinfo objectForKey:@"verify"]);   
    } else {
        //print mystery code.
        NSLog(@"%d",request.responseStatusCode);
    
    }
    

    }

    Basically when you start the request using request startSynchronous it executes you server side code and returns a response string (or fails), you catch and handle the response string (or failure)in a delegate method you must implement from ASIHttpRequest -(void)requestFinished:(ASIHTTPRequest *)request. In the sample code I am parsing the response string into a JSON and then putting it into a dictionary for later use.

    If you go through the tutorial this will all make sense to you very quickly. Hope it helps, good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a reasonable size flat file database of text documents mostly saved in
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.