Pages: [1]   Go Down
Author Topic: HTTP client is giving wrong results..  (Read 896 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 25
beginner with Arduino and prototyping.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello there,

I have a java server on local host, that sets the status of LCD either 0 or 1.
the resource URI is: http://localhost/mytrain/restserver/train/lcd
and the content of the page is: {"lcdStatus": 0} or {"lcdStatus":1}

I'm trying to make my Arduino HTTP client reads it, and depending on the value 0 or 1 to control an LCD.
But it's not working.. When it gives an answer, then it's ÿ

Could anyone please help me here? what should I write in the GET request?
My Arduino is Mega 2560, with Ethernet shield

thanks in advance
« Last Edit: June 12, 2014, 11:56:45 am by maimi » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

post your code

localhost = 127.0.0.1  is an internal loopback device address,
you must use the external NIC number, e.g. 192.168.1.10

http://192.168.1.10/mytrain/restserver/train/lcd

give it a try
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 25
beginner with Arduino and prototyping.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks, you're right.. However I must enter credentials, user name and password.. How to do this in Arduino code?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

carefully?

Google for POST (although it can need another protocol)
« Last Edit: June 13, 2014, 10:29:45 am by robtillaart » Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 25
beginner with Arduino and prototyping.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks! great idea! didn't know that one could use POST in Arduino!
I found this.. http://forum.arduino.cc/index.php?topic=155218.0
I'll see how I can use it in my code..
Logged

Pages: [1]   Go Up
Jump to: