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 7502139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:45:55+00:00 2026-05-29T20:45:55+00:00

I’m doing an application that should work with the server. Need to be authorized

  • 0

I’m doing an application that should work with the server.

Need to be authorized on the server through the program using the username and password.
I need to make a request to the server with the line:

{“login”: “mad_fashist”, “password”: “eqeeuq313371”, “method”: “authentificator”}

The string must be in Json.

In response, I should get a line if authentication fails:

{“validated”: “false”, “kuid”: “”, “sid”: “”, “uid”: “”}

And if authentication is passed:

{“validated”:”true”,”kuid”:”6″,”sid”:”834fe9b4626502bf9ff23485a408ac40″,”uid”:”69″}

The question is how to send and receive all of the above?

  • 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-05-29T20:45:56+00:00Added an answer on May 29, 2026 at 8:45 pm

    Use SBJson framework. and do smth like:

    -(void)requestProjects
    {
    
    
        //I prepare the string
    
        NSString *preparedString=[NSString stringWithFormat:@"%@ %@", self.lastDate, self.currentCategory];
        NSDictionary *jsonDict = [NSDictionary dictionaryWithObject:preparedString forKey:@"request"];
    
        //Prepare convert to json string
        NSString *jsonRequest = [jsonDict JSONRepresentation];
    
        NSLog(@"jsonRequest is %@", jsonRequest);
    
        //Set the URL YOU WILL PROVIDE
    
        NSURL *url = [NSURL URLWithString:@"http:xxxxxxxxxxxxxxxxxxx"];
    
        //PREPARE the request
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
                                                               cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
    
        //Prepare data which will contain the json request string.
        NSData *requestData = [NSData dataWithBytes:[jsonRequest UTF8String] length:[jsonRequest length]];
    
        //Set the propreties of the request 
        [request setHTTPMethod:@"POST"];
        [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
        [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
        [request setValue:[NSString stringWithFormat:@"%d", [requestData length]] forHTTPHeaderField:@"Content-Length"];
        [request setValue:jsonRequest forHTTPHeaderField:@"Query-string"];
        //set the data prepared
        [request setHTTPBody: requestData];
    
        //Initialize the connection with request
        NSURLConnection *connection = [[NSURLConnection alloc]initWithRequest:request delegate:self];
        //Start the connection
        [delegate showIndicator];
        [connection start];
    
    }
    
    
    //delegate methods:
    
    //METHODS TO HANßDLE RESPONSE
    #pragma mark NSURLConnection delegate methods
    //WHen receiving the response
    - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
    
        NSLog(@" Did receive respone");
        [responseData setLength:0];
    
    
    }
    
    - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
        //While receiving the response data
        [responseData appendData:data];
    }
    
    - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
        //When failed just log
         [delegate hideIndicator];
        NSLog(@"Connection failed!");
        NSLog(@"Error %@", error);
    }
    
    - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
        //When the response data is downloaded 
       // NSLog(@" Data obtained %@", responseData);
        NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
       // NSLog(@" Response String %@", responseString);
        //converted response json string to a simple NSdictionary
        //If the response string is really JSONABLE I will have the data u sent me displayed succefully
    
        NSMutableArray *results = [responseString JSONValue];
        NSLog(@"Response: %@", results);
    /// la la al alal alaa
    }
    

    It’s your back end who should define how the response in Json will look like

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build

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.