2 Replies Latest reply on Mar 13, 2014 9:51 AM by teknoraver

    How to send data from Galileo to a web php page

    Ilthebest

      Hello,

      I am trying to send data, for example, a string of now, then the data collected by a sensor its plant Galileo to a php page in the network, which interprets the data and saves it to a DB.

      How can I do?

       

      While surfing the net I adapted this code, attached to the post, but it gives me a bad request (Error 400)

        • 1. Re: How to send data from Galileo to a web php page
          AlexT_Intel

          I think the reason is that you don't have the "http://" specifier in your GET request. The other two headers are actually not even needed that much. I haven't run the sketch, just used the telnet, but that's essentially the same stuff and I was able to reproduce the 400 error without "http://" and after adding it everything works fine. Looks like even the HTML/1.0 is not necessary.


          user@linux> telnet 78.46.227.17 80

          Trying 78.46.227.17...

          Connected to 78.46.227.17.

          Escape character is '^]'.

          GET http://magliani.altervista.org/arduino.php?testo=ciao HTTP/1.0


           

          HTTP/1.1 200 OK

          Date: Tue, 11 Mar 2014 19:37:16 GMT

          Server: Apache

          Vary: Accept-Encoding

          Connection: close

          Content-Type: text/html

           

          <HTML>

          <HEAD>

          <TITLE>Accesso al servizio</TITLE>

          </HEAD>

          <BODY>

          <H2>Gestione accessi</H2>

          <HR>

          testo : ciao</BODY>

          </HTML>Connection closed by foreign host.

           

          user@linux> telnet 78.46.227.17 80

          Trying 78.46.227.17...

          Connected to 78.46.227.17.

          Escape character is '^]'.

          GET magliani.altervista.org/arduino.php?testo=ciao HTTP/1.0


           

          HTTP/1.1 400 Bad Request

          Date: Tue, 11 Mar 2014 19:38:40 GMT

          Server: Apache

          Content-Length: 226

          Connection: close

          Content-Type: text/html; charset=iso-8859-1

           

          <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

          <html><head>

          <title>400 Bad Request</title>

          </head><body>

          <h1>Bad Request</h1>

          <p>Your browser sent a request that this server could not understand.<br />

          </p>

          </body></html>

          Connection closed by foreign host.

          • 2. Re: How to send data from Galileo to a web php page
            teknoraver

            you have to remove both "http://" and the hostname from the request, and specify the hostname in a separate "Host" header.

            For example, to request http://www.intel.com/robots.txt you have to do:

             

            $ telnet www.intel.com 80

            Trying 77.67.97.22...

            Connected to a961.g.akamai.net.

            Escape character is '^]'.

            GET /robots.txt HTTP/1.1

            Host: www.intel.com

             

             

            HTTP/1.1 200 OK

            Content-Length: 893

            Content-Type: text/plain

             

            User-agent: *

            Disallow: /cgi

            Disallow: /iaweb/

            ...