Problem with dohttpreq
Avatar

Hi, I have a problem with dohttpreq. In test.txt has text "sad". I need to compare it and, if so: dofile , else: print log. But my code has problem with this.

dohttpreq( "http://mytestsite.com/test.txt",
    function(data)
		if data == sad
			log( "Retrieved server data:\n" .. data )
		else
			log(data)
			log(data)
		end
    end
)

But my log file print this

02:50:26 PM Log: Incoming HTTP Request/Request
02:50:26 PM Log: http://mytestsite.com/test.txt
02:50:26 PM Log: 15189
02:50:26 PM Log: Launching Async HTTP Thread
02:50:27 PM Lua: sad
02:50:27 PM Lua: sad

I test this code, but he dosent work for me

func = func or function(success, pagedata)
	if success then
		if string.find(tostring(pagedata), "sad") then
			log(data)
		end
	else
		log(data)
		log(data)
		log(data)
	end
end


Steam:http_request("http://mytestsite.com/test.txt", func)
Replies
30 829