PtokaX forum

Development Section => Your Developing Problems => Topic started by: Kanubach on 13 November, 2008, 15:32:14

Title: Is it posible to send HTTP POST/GET requests from lua scripts ?
Post by: Kanubach on 13 November, 2008, 15:32:14
Hi.

I would like to run a POST or GET (HTTP protocol) in a script lua, and get back data from an ouside website.

something like:

Code: [Select]
content = HTTPGet("http://www.mysite.com/script.php?x=0&y=1")
Is it possible in lua ?

Thank's.
Title: Re: Is it posible to send HTTP POST/GET requests from lua scripts ?
Post by: ATAG on 13 November, 2008, 17:35:01
Example:
Code: [Select]
http = require "socket.http"
result, statuscode, content = http.request("http://www.mysite.com/script.php?x=0&y=1")
More info: http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/http.html
Title: Re: Is it posible to send HTTP POST/GET requests from lua scripts ?
Post by: Kanubach on 14 November, 2008, 18:29:27
Greats !
A lot of thanks...