title: Login system using curl in php
body: <p>first of all i have done it using classes but actually i have to do it using curl. I want to send my email username and password to system and then taking this values for login check and redirect to table.php</p>
  
  <p>This is my service i tried: </p>
  
  <pre><code>        case 'LOGIN':
          $uname = strip_tags($_POST['txt_uname_email']);
          $upass = strip_tags($_POST['txt_password']);
  
          $staffuname         =$comingdata[0];
          $staffpassword      =$comingdata[1];
  
          try
              {
                  $login = $myPDO-&gt;query("SELECT * FROM users WHERE (user_name='{$uname}' OR user_email='{$uname}') AND user_pass='{$upass}' ")-&gt;fetch(PDO::FETCH_ASSOC);
                  if($login-&gt;rowCount() &gt; 0 )
                  {
                      Redirect('table.php');
                  }else{
                      $data=array("Response"=&gt;"Failed");
                  }
              }
              catch(PDOException $e)
              {
                  echo $e-&gt;getMessage();
              }
  
          break;
  </code></pre>
  
  <p>and here is the curl login post:</p>
  
  <pre><code>     if(isset($_POST['btn-login']))
       {
  
  $uname = strip_tags($_POST['txt_uname_email']);
  $upass = strip_tags($_POST['txt_password']);
  
   $query=$uname.'|'.$upass;
   echo $query;
   $params=array(
          'action' =&gt; "LOGIN",
          'query' =&gt; $query
              );
          $postData='';
          foreach($params as $k =&gt; $v){
              $postData .= $k . '='.$v.'&amp;';
          }
          rtrim($postData, '&amp;');
          $ch = curl_init();
          curl_setopt($ch, CURLOPT_URL,"http://localhost/skynebtrack/pages/dutyservice.php");
          curl_setopt($ch, CURLOPT_POST, count($params));
          curl_setopt($ch, CURLOPT_POSTFIELDS,$postData);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          $response = curl_exec($ch);
          print_r($response);
          curl_close ($ch);
          $cvp=json_decode($response,true);
  
  if($cvp["Response"]=="SUCCESSFULL")
  {
      $_SESSION['user_session'] = $userRow['user_id'];
      redirect('table.php');
  }
  else
  {
  
  }   
    }
  </code></pre>
  
  <p>i am getting ıname and password but it doesntredirect me to home page. Thanks for yor feedback.</p>