problems while sendingsocket:write ("GET http://api.wunderground.com/api/xxxMYxKEY<<);

  • 1
  • Question
  • Updated 4 years ago
  • Answered
when i open a socket connection and send
socket:write ("GET http://api.wunderground.com/api/xxxHE... \n");

i get in my answer: you mus supply a key

how i can get a answer?
Photo of mnies

mnies

  • 4 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 1
Photo of Tim Roche

Tim Roche, Official Rep

  • 328 Posts
  • 36 Reply Likes
Please make sure you are using a valid key

-tim
Photo of mnies

mnies

  • 4 Posts
  • 0 Reply Likes
I already try it like this
socket:write("GET http://api.wunderground.com/api/e1aa5...

the answer is:
"termsofService":"http://www.wunderground.com/weather/a...": { "missingkey" key"
Photo of mnies

mnies

  • 4 Posts
  • 0 Reply Likes
i have to connect like this:
socket = vpos.communication.Socket ("wunderground.com", 80); .. d);

always missing key, when i try it with php the response is ok
Photo of mnies

mnies

  • 4 Posts
  • 0 Reply Likes
socket = vpos.communication.Socket ("wunderground.com", 80);

socket:write("GET http://api.wunderground.com/api/key=e...");

d, byteCount = socket:read (2000, 8000);

vpos.view.showWindow("hit" .. d);
Photo of afelicioni

afelicioni

  • 227 Posts
  • 43 Reply Likes
Even if fine I can't figure out the syntax (my fault) so can't try myself, seems you incorrectly asking a full URL instead of just resource path, for the socket scenario.
Hostname will need a fix too, something like the following to get you the idea

socket = vpos.communication.Socket("api.wunderground.com", 80);
socket:write("GET /api/key=e...");
d, byteCount = socket:read (2000, 8000);
vpos.view.showWindow("hit" .. d);