title: Parameters are not being POSTED in AFNetworking while using GET
body: <p>What I'm trying to do is a <strong>LOGIN</strong> scenario. I'm using <strong>AFNetworking 3.0</strong> and passing the username and password as parameters as shown in the code below:</p>
  
  <pre><code>NSDictionary *parameters = @{@"ePharmUserUsername":self.usernameTf.text,@"ePharmUserPassword":self.passwordTf.text};
   AFHTTPSessionManager *mgr = [AFHTTPSessionManager manager];
  mgr.requestSerializer = [AFHTTPRequestSerializer serializer];
  [mgr.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"content-type"];
  [mgr.requestSerializer setValue:@"utf-8" forHTTPHeaderField:@"accept-charset"];
  [mgr GET:LOGIN parameters:parameters progress:^(NSProgress * _Nonnull uploadProgress) {
  }
  success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSLog(@"response is : %@",responseObject);
  
        if ([[responseObject objectForKey:@"success"] intValue] == 104) {
            UIAlertController * alert=   [UIAlertController
                                          alertControllerWithTitle:@"Internal Error"
                                          message:[responseObject objectForKey:@"message"]
                                          preferredStyle:UIAlertControllerStyleAlert];
  
            UIAlertAction* okButton = [UIAlertAction
                                       actionWithTitle:@"OK"
                                       style:UIAlertActionStyleDefault
                                       handler:^(UIAlertAction * action)
                                       {}];
  
            [alert addAction:okButton];
            [SVProgressHUD dismiss];
            [self presentViewController:alert animated:YES completion:nil];
            [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
  
            /********************MEMORY_MANAGEMENT_PART*********************/
            okButton  = nil;
            alert= nil;
            /********************MEMORY_MANAGEMENT_PART*********************/
  
        }
  
  
      else if ([[responseObject objectForKey:@"success"] intValue] == 106) {
          UIAlertController * alert=   [UIAlertController
                                        alertControllerWithTitle:@"Missing Credantials"
                                        message:[responseObject objectForKey:@"message"]
                                        preferredStyle:UIAlertControllerStyleAlert];
  
          UIAlertAction* okButton = [UIAlertAction
                                     actionWithTitle:@"OK"
                                     style:UIAlertActionStyleDefault
                                     handler:^(UIAlertAction * action)
                                     {}];
  
          [alert addAction:okButton];
          [SVProgressHUD dismiss];
          [self presentViewController:alert animated:YES completion:nil];
          [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
  
          /********************MEMORY_MANAGEMENT_PART*********************/
          okButton  = nil;
          alert= nil;
          /********************MEMORY_MANAGEMENT_PART*********************/
  
      }
        else
        {
  
  
            [SVProgressHUD dismiss];
            [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
  
        }
  
  
  
    }
    failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"the error is: %@",error);
        [SVProgressHUD dismiss];
  
  
    }];
  </code></pre>
  
  <p>Also I'm using <strong>PHP</strong> as backend with <strong>MySQL</strong> as database server.
  Here is my PHP code:</p>
  
  <pre><code>&lt;?php
  header('Content-type: application/json; charset=utf-8;');
  $link = mysqli_connect("localhost", "root", "");
  mysqli_query($link, "SET NAMES UTF8");
  $db = mysqli_select_db($link, "ePharm") or die("Cannot select Database.");
  
      $response = array();
      $response["Username"] = array();
  
      if (!empty($_POST)) {
  
      $Username = $_POST['ePharmUserUsername'];
      $Password = $_POST['ePharmUserPassword'];
  
      if (empty($Username) || empty($Password)) {
          $response["success"] = 106;
          $response["message"] = "One or both of the fields are empty.";
          die(json_encode($response));
      }
  
      else
    {
  
      $query = "SELECT * FROM ePharmUser WHERE ePharmUserUsername='$Username' AND ePharmUserPassword = '$Password'";        
      $result = mysqli_query($link, $query);
      $row = mysqli_fetch_array($result);
  
          if (empty($row)) {
          $response["success"] = 108;
          $response["message"] = "Invalid Username or Password";
          die(json_encode($response));
          }
  
          if (!empty($row)) {
          $users = array();   
          $users["ePharmUserId"] = $row["ePharmUserId"];
          $users["ePharmUserName"] = $row["ePharmUserName"];
          $users["ePharmUserPhoneNumber"] = $row["ePharmUserPhoneNumber"];
          $users["ePharmUserProfilePictureUrl"] = $row["ePharmUserProfilePictureUrl"];
          $users["ePharmUserPassword"] = $row["ePharmUserPassword"];
          $users["ePharmUserEmail"] = $row["ePharmUserEmail"];
          $users["ePharmUserUsername"] = $row["ePharmUserUsername"];
          array_push($response["Username"], $users);
          $response["success"] = 100;
          $response["message"] = "success";
          die(json_encode($response));   
  
       }
  
  } 
  
      }
  
  
        else {
          $response["success"] = 104;
          $response["message"] = "The App was unable to Post Data to DB Error 
          104";
            die(json_encode($response));
          }
  </code></pre>
  
  <p>When I'm posting data from the objective-c code (client side) the process reaches the <code>(!empty($_POST))</code> in <strong>PHP</strong> that is always false and so goes to the else statement. I already searched for some solutions. Here is what I found <a href="https://stackoverflow.com/questions/20594584/after-setting-custom-headers-in-afnetworking-2-x-the-parameters-are-not-being-r">Link1</a> <a href="https://stackoverflow.com/questions/20594584/after-setting-custom-headers-in-afnetworking-2-x-the-parameters-are-not-being-r">Link2</a> <a href="https://stackoverflow.com/questions/30931861/how-to-post-parameter-like-register-id3-in-afnetworking">Link3</a>, but they don't fit in my situation. Any help?</p>