Posted 29 July 2017 - 04:22 PM
Hi,
So I'm not really new to CC (been using it for a few years now) but I just recently started using the HTTP api.
What I'm trying to do is a log system (the computer POST's on a URL and the server logs it).
On the server, for testing, the code is just printing back the body of the request along with a form to test it with the browser.
On ComputerCraft, http.get(url) works but http.post(url,postData) doesn't.
But in my browser, it works.
And my server doesn't log any error, nor does it log the POST request from CC…
My code:
I get the following result:
So I was wondering if I did something wrong and if you guys could help me.
Also sorry if I wasn't descriptive enough.
So I'm not really new to CC (been using it for a few years now) but I just recently started using the HTTP api.
What I'm trying to do is a log system (the computer POST's on a URL and the server logs it).
On the server, for testing, the code is just printing back the body of the request along with a form to test it with the browser.
On ComputerCraft, http.get(url) works but http.post(url,postData) doesn't.
But in my browser, it works.
And my server doesn't log any error, nor does it log the POST request from CC…
My code:
local URL="http://raspnathan.familledecher.com:48484/CC/api/report/tree"
local a=http.get(URL)
local b=http.post(URL,"a=1")
print(a)
print(B)/>/>
if a then a.close() end
if b then b.close() end
I get the following result:
table: 23680b25
nil
So I was wondering if I did something wrong and if you guys could help me.
Also sorry if I wasn't descriptive enough.
Edited on 02 August 2017 - 01:37 PM