http.Post

I’m trying to make a http post but I get the following in the server console:



httpclient.cpp (2374) : Assertion Failed: pHost && *pHost
Assert( Assertion Failed: pHost && *pHost ):httpclient.cpp:2374

unsuccessful


Can you show us how are you calling it?



http.Post( "104.131.80.188:9000/ping", "user=user&licence=345bdddfs5&prod=ras&x_version=1.0",
function ( responseText, contentLength, responseHeaders, statusCode )
    print( responseText )
    print( conentLength )
    print( responseHeaders )
    print( statusCode )
end,
function( error )
    print( error )
end)


http.Post takes a table as the second argument. What you are trying to do there is a GET request, not a post.

Either use

http.Fetch or use Post as follows:

[lua]http.Post( “104.131.80.188:9000/ping”, {user = user, licence = “345bdddfs5”, prod = “ras”, x_version = “1.0”},
function ( responseText, contentLength, responseHeaders, statusCode )
print( responseText )
print( conentLength )
print( responseHeaders )
print( statusCode )
end,
function( error )
print( error )
end)[/lua]

What are you going to use that for ?

License server, in other words I can check the version people are using & how many people are using one license.

So you going to use that for an addon ? Are you going to post on scriptfodder ?

Yes an addon, I’m not yet sure whether or not it’s going on ScriptFodder (I’m debating if it’s worth paying the $15 a month). If I don’t post this on ScriptFodder I’m planning on using this to help me fix errors people are having.

This error can be caused if you’re calling http.* too early