Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Announcements
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9868 Discussions

How to send data from Galileo to a web php page

FMagl
Novice
1,415 Views

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)

0 Kudos
1 Solution
AT9
Honored Contributor II
223 Views

I think the reason is that you don't have the "http://communities.intel.com/ 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://communities.intel.com/ 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://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

Accesso al servizio

Gestione accessi

testo : ciao

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">

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.

Connection closed by foreign host.

View solution in original post

2 Replies
AT9
Honored Contributor II
224 Views

I think the reason is that you don't have the "http://communities.intel.com/ 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://communities.intel.com/ 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://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

Accesso al servizio

Gestione accessi

testo : ciao

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">

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.

Connection closed by foreign host.

MCroc1
Novice
223 Views

you have to remove both "http://communities.intel.com/ 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 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/

...

Reply