What method to use not to display the json data in the php page that serves as a request for the android app

0

Good night, I have an android app and I'm using this php code for a json request and I wanted the data not to appear when someone used the url, because then you can see the output information of the select

How could I not show and be able to request the data in the app?

<?php

// APK WebService CRUD

ini_set('default_charset', 'utf-8');

require_once('config.inc.php');

$sql = 'SELECT * FROM 'contato'';

$statement = $connection->prepare($sql);

$statement->execute();

if($statement->rowCount()) {
  $row_all = $statement->fetchall(PDO::FETCH_ASSOC);

  header('Content-type: application/json');

  echo json_encode($row_all);

} elseif (!$statement->rowCount()) {
  echo "sem linhas";
}

?>

Output:

[{"id":"6","nome":"micael","email":"mica@b"},{"id":"7","nome":"agusto","email":"a@b"},{"id":"8","nome":"alma","email":"c@hotmail"}] 

Thank you in advance

    
asked by anonymous 29.11.2017 / 06:21

0 answers