<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dev.playonset.com/index.php?action=history&amp;feed=atom&amp;title=http_result_error</id>
	<title>http result error - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://dev.playonset.com/index.php?action=history&amp;feed=atom&amp;title=http_result_error"/>
	<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=http_result_error&amp;action=history"/>
	<updated>2026-04-24T10:18:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://dev.playonset.com/index.php?title=http_result_error&amp;diff=3740&amp;oldid=prev</id>
		<title>BlueMountains: Created page with &quot;{{Info|Function|Server|1.0.3}}  {{FuncDescription|Returns any error after a request was made.}}  {{FuncSyntax|http_result_error(http)}}  {{FuncParameters}} {{FuncParam|http|Th...&quot;</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=http_result_error&amp;diff=3740&amp;oldid=prev"/>
		<updated>2020-01-24T17:21:46Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Info|Function|Server|1.0.3}}  {{FuncDescription|Returns any error after a request was made.}}  {{FuncSyntax|http_result_error(http)}}  {{FuncParameters}} {{FuncParam|http|Th...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Info|Function|Server|1.0.3}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|Returns any error after a request was made.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|http_result_error(http)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|http|The http identifier.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncReturnValue|Returns the error as an string. (If any)}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function test_error_code()&lt;br /&gt;
	local r = http_create()&lt;br /&gt;
	http_set_resolver_protocol(r, &amp;quot;ipv4&amp;quot;)&lt;br /&gt;
	http_set_protocol(r, &amp;quot;http&amp;quot;)&lt;br /&gt;
	http_set_host(r, &amp;quot;httpstat.us&amp;quot;)&lt;br /&gt;
	http_set_port(r, 80)&lt;br /&gt;
	http_set_target(r, &amp;quot;/431&amp;quot;)&lt;br /&gt;
	http_set_verb(r, &amp;quot;get&amp;quot;)&lt;br /&gt;
	http_set_timeout(r, 30)&lt;br /&gt;
	http_set_keepalive(r, false)&lt;br /&gt;
	&lt;br /&gt;
	if not http_send(r) then&lt;br /&gt;
		http_destroy(r)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Generic Event that is called for every HTTP request. If you need to pass custom parameters&lt;br /&gt;
to it you can specify your own callback function in http_send including your parameters.&lt;br /&gt;
]]--&lt;br /&gt;
AddEvent(&amp;quot;OnHttpRequestComplete&amp;quot;, function(http)&lt;br /&gt;
&lt;br /&gt;
	if http_is_error(http) then&lt;br /&gt;
		print(&amp;quot;OnHttpRequestComplete failed for id&amp;quot;, http..&amp;quot;: &amp;quot;..http_result_error(http))&lt;br /&gt;
	else&lt;br /&gt;
		print(&amp;quot;OnHttpRequestComplete succeeded for id&amp;quot;, http)&lt;br /&gt;
		print_active_results(http)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	http_destroy(http)&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
function print_active_results(http)&lt;br /&gt;
	local body = http_result_body(http)&lt;br /&gt;
	local header = http_result_header(http)&lt;br /&gt;
	local status = http_result_status(http)&lt;br /&gt;
	&lt;br /&gt;
	print(&amp;quot;\tBody: &amp;quot;, body)&lt;br /&gt;
	print(&amp;quot;\tHTTP Status: &amp;quot;, status)&lt;br /&gt;
	print(&amp;quot;\t Headers:&amp;quot;)&lt;br /&gt;
	for k, v in pairs(header) do&lt;br /&gt;
		print(&amp;quot;\t&amp;quot;, k, v)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{RelatedFunctions}}&lt;br /&gt;
{{HttpFunctions}}&lt;/div&gt;</summary>
		<author><name>BlueMountains</name></author>
	</entry>
</feed>