I have a Wi-Fi sender sensor (CC3200 from texas instruments) and I want to send the data via wifi to a database MySQL
local (local PC).
The sensor metric is configured as a http
client.
In the PC I have installed XAMPP
, the database already developed, a Script PHP
( servidor.php
) that serves as the gateway for the data of the speck.
I put said Script
below:
<?php
//incluimos el script insertarbd.php donde tenemos la función crear_base_datos()
include 'insertarbd.php';
//incluimos el script de emergencias.php
include 'emergencias.php';
//Cogemos de la url el valor de los sensores enviados por el PIC mediante $_GET
@$buffer=$_GET["value"];
//@$buffer=$_POST["value"];
//Llamamos a la función crear_base_datos que se va encargar de almacenar en la base
//de datos los valores de los sensores
crear_base_datos($buffer);
//llamamos a la función de emergencias
//emergencias();
//Almacenamos los datos en un fichero de texto (Opcional)
$DescriptorFichero = fopen("fichero_prueba.txt","w");
//Escribimos la primera línea dentro de él
fputs($DescriptorFichero,$buffer);
//Cerramos el fichero
fclose($DescriptorFichero);
?>
In a previous project all this worked for me, but now I have changed my sensor and when I send the data the following happens to me (according to the capture with Wireshark
):
**HTTP/1.1 400 Bad Request**
My questions are:
-
Should I put the directory in the
"GET"
message? That is, do I have to do aGET
with"/servidor.php?value=123456\n"
or do I have to include the directory"/xampp/htdocs.../servidor.php?value=123456"
? - Is there a problem for this connection between the sensor and the database to occur using a
Script PHP
that you have not taken into account?