I have a problem with the Json API of Cahtfuel with PHP, I do not know if it does not work for me, maybe I'm doing something wrong or I'm missing something, it consists of the following: I have a user entry and a json api that is with a url and the parameter specified by the user to consume a json using GET (chatfuel requires its own json attribute format) and chatfuel at the time of testing it throws me the json error "unable to parse json" and does not return the answer wanted, thanks for your help and I leave the php code that makes the procedure.
<?php
include 'config.php';
$parametro_a_consultar = $_REQUEST["tienda"];
$sql = "SELECT id, description FROM negocio WHERE name LIKE '%$parametro_a_consultar%'";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($result)){
/* Acá se genera el json. */
$json = '{
"set_attributes":
{
"id-tienda": "'.$row['id'].'",
"descripcion-tienda": "'.$row['description'].'"
}
}';
/**************************/
echo $json;
}
?>