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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:32:11+00:00 2026-06-06T14:32:11+00:00

This is my php where I need to authenticate: <?php $username=$_POST[m_username]; $password=$_POST[m_password]; /* $username=$_GET[m_username];

  • 0

This is my php where I need to authenticate:

<?php

        $username=$_POST["m_username"];
        $password=$_POST["m_password"];
/*      
        $username=$_GET["m_username"];
        $password=$_GET["m_password"];
*/

?>

I am using below code to authenticate from my iPhone app. But it is not authenticating. I dont know what is the issue that its not working. It says null parameters/values sent.

NSString *urlAsString =[NSString stringWithFormat:@"http://www.myurl.com/abc/authenticate.php"];

NSURL *url = [NSURL URLWithString:urlAsString];

NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url]; 

[urlRequest setTimeoutInterval:30.0f];

[urlRequest setHTTPMethod:@"POST"];

[urlRequest addValue:@"test" forHTTPHeaderField:@"m_username" ];

[urlRequest addValue:@"123" forHTTPHeaderField:@"m_password" ];

[[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];

NSOperationQueue *queue = [[NSOperationQueue alloc] init];

[NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response,NSData *data, NSError *error) {

    if ([data length] >0 && error == nil){

        html = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

        NSLog(@"HTML = %@", html);

        receivedData = [NSMutableData data];

    }
    else if ([data length] == 0 && error == nil){

        NSLog(@"Nothing was downloaded."); 

    }

    else if (error != nil){

        NSLog(@"Error happened = %@", error);
    } 
}];

// Start loading data
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
if (theConnection) 
{
    // Create the NSMutableData to hold the received data
    receivedData = [NSMutableData data];

} 
else {
    // Inform the user the connection failed.

}
  • 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-06T14:32:13+00:00Added an answer on June 6, 2026 at 2:32 pm
    [urlRequest addValue:@"test" forHTTPHeaderField:@"m_username" ];
    
    [urlRequest addValue:@"123" forHTTPHeaderField:@"m_password" ];
    

    This is your problem. You’re sending your values as HTTP header fields, not as post data. Post data goes in the request body, not the header. So PHP doesn’t treat it as incoming post fields to look at in the $_POST array. (Those fields might turn up in the $_SERVER array, though… I’ve never tried that. It’s not the preferred method for sending post data, anyhow.)

    Do this instead:

    NSString *myRequestString = @"m_username=test&m_password=123";
    NSData *myRequestData = [NSData dataWithBytes: [myRequestString UTF8String] 
                                            length: [myRequestString length]];
    
    [urlRequest setHTTPBody: myRequestData];
    

    You can, obviously, compose myRequestString as a formatted string, dropping in values the user provides, if needed.

    Also note that since you’re hitting a non-SSL URL, this data will be sent in the clear, which is known by all the kids these days as A Bad Idea.

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

Sidebar

Related Questions

I need to upload a given image using Amazon S3 I have this PHP:
I need help to use jConfirm with this existing code (php & Jquery &
I need a little help with the fsockopen function. I have this PHP code:
Hi All Nightowls out there :), I need to authenticate username and password provided
i need to parse this php xml response in android: <?phpxml version=1.0 encoding=utf-8?> <SmsResponse>
I'm sure this is a simple thing to do but in php I need
I have a file as documentRoot/app/webroot/myFile.php I need to be able to access this
I need a PHP script to decrypt the RSA encrypted string generated by this
I need rewrite this url http://adresa.com/article.php?act=view&id=1113 to http://adresa.com/view/1113 I make it with mod_rewrite in
I need help finishing this statement. It is frustrating that two of the PHP

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.