lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

   local http = require("socket.http")
   local io = require("io")
   local ltn12 = require("ltn12")
   UserID = "userID=XXXXX"
   APIKey = "apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
   CharID = "characterID=XXXXXXX"

   --Lame I know...
   reqbody = UserID.."&"..APIKey.."&"..CharID

   http.request {
      method = "POST",
      url = "http://api.eve-online.com/char/CharacterSheet.xml.aspx";,
      headers= { ["Content-Type"] = "application/x-www-form-urlencoded",
               ["Content-Length"] = string.len(reqbody),
      },
      source = ltn12.source.string(reqbody),
      sink = ltn12.sink.file(io.stdout)
   }

On execution I get an error from the remote server about the request verb
bad.

That's not what happens here. What I get is:

<?xml version='1.0' encoding='UTF-8'?>
<eveapi version="2">
  <currentTime>2009-07-22 06:59:17</currentTime>
  <error code="106">Must provide userID parameter for authentication.</error>
  <cachedUntil>2009-07-22 07:04:17</cachedUntil>
</eveapi>

What version of LuaSocket are you using?

Regards,
Diego