Garry's Mod 9 lua502 Lua HTTP plugin.
Find a file
2018-06-23 19:28:45 +03:00
Release Initial commit 2018-06-23 19:22:28 +03:00
http.cpp Initial commit 2018-06-23 19:22:28 +03:00
http.h Initial commit 2018-06-23 19:22:28 +03:00
json.cpp Initial commit 2018-06-23 19:22:28 +03:00
main.cpp Initial commit 2018-06-23 19:22:28 +03:00
README.md Create README.md 2018-06-23 19:28:45 +03:00
sdk_http.vcxproj Initial commit 2018-06-23 19:22:28 +03:00
sdk_http.vcxproj.filters Initial commit 2018-06-23 19:22:28 +03:00
sdk_http.vcxproj.user Initial commit 2018-06-23 19:22:28 +03:00

sdk_http

GMod 9 Asynchronous HTTP Lib

Example:

--HTTP GET
http.Get({["url"] = "http://ident.me"},function(body,code)
	Msg(string.format("http.Get:\nBody: %s\nHTTP Code: %d\n\n",body,code))
end,function(code)
	Msg(string.format("http.Get:\nCURL Error %d\n\n",code))
end)

--HTTP POST
http.Post(
	{
		["url"] = "http://localhost/test/post.php",
		["args"] = "a=yes&b=loles"
	},
	function(body,code)
		Msg(string.format("http.Post:\nResult: %s\n\n",body));
	end,function(code)
		Msg(string.format("http.Post:\nCURL Error %d\n\n",code))
	end
)

--HTTP POST multipart/form-data
http.PostMultipart({
	["url"] = "http://localhost/test/post_multipart_file.php",
	["form"] = {
		["arg"] = "value",
	}
},function()end,function()end)

--HTTP POST multipart/form-data (upload file)
http.PostMultipart(
	{
		["url"] = "http://localhost/test/post_multipart_file.php",
		["file"] = {
			{"file1","test.txt","A veeery long file"}
		}
	},
	function(body,code)
		Msg(string.format("http.PostMultipart:\n%s\n\n",body))
	end,function(code)
		Msg(string.format("http.PostMultipart:\nCURL Error %d\n\n",code))
	end
)