title: ionic 3 HTTP-GET connect with input username and password for access to php page
body: <p>What I am trying to do is add a password,username headers to this http get request. Then have the .php page allow the function if the username and password are correct.  I have seen a lot of answers concerning headers for basic authorization and posting data.  What I am trying to do is add some basic security to this http get request.  </p>
  
  <p>data.ts</p>
  
  <pre><code>getData() {     
      let headers = new Headers({ 'Content-Type':'*/*' });
      headers.append('Authorization', 'Basic' + (loginname + ':' + password) );
      this.http.get('https:data.php', { headers: headers }, {})
      .map(res =&gt; res.json())
      .subscribe(data =&gt; {
      console.log(data.data);
  },
      err =&gt; {
      this.connectionAlert();
  });
  </code></pre>
  
  <p>}</p>
  
  <p>data.php</p>
  
  <pre><code>&lt;?php
  $login = ‘loginname’;  // move to lib config
  $pass = ‘password’;  // move to lib config 
  
  if (!isset($_SERVER['PHP_AUTH_PW']!= $pass || $_SERVER['PHP_AUTH_USER'] != $login)) {
      header('WWW-Authenticate: Basic realm="My Site"');
      header('HTTP/1.0 401 Unauthorized');
      echo 'User not allowed';
      exit;
  } else {
      echo "&lt;p&gt;Sucess&lt;/p&gt;";
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>My error is </p>
  
  <p>Cannot use isset() on the result of an expression (you can use "null !== expression" instead)</p>
  
  <p>The answers I have found online do not seem to fix the problem.</p>