http.Get not work

http.Get(“http://www.google.com”,"", GetCallBack)

function GetCallBack(contents, size)
Msg("GetCallBack
")
end

so message print out on server console

is it Http.Get borken long time?

What?

If you’re talking about the nothing gets printed then yeah there’s a limit on how much you can print at once. At least that’s what I’ve found out. Try writing the content to a file if this is the problem or cut the text out with patterns.

[editline]04:36PM[/editline]

oh lol you need to print the string “contents”

like so:

[lua]
http.Get(“http://www.google.com”,"", GetCallBack)

function GetCallBack(contents, size)
Msg(contents)
end
[/lua]

[editline]04:37PM[/editline]

actually I don’t knwo what you want

i add file.Write(“dddd.txt”, contents) nothing happen

I suggest you putting the funtion before the http.Get

GetCallBack is nil before you do function GetCallBack() blah blah blah end. The function GetCallBack() … end line basically does:
[lua]
GetCallBack = function() … end
[/lua]

Or in other words GetCallBack is a variable that is equal to that function.

Just move the http.Get line beneath the function.

i change to
http.Get(“http://www.google.com”,"", function (contents, size)
file.Write(“dddd.txt”, “777”)
end)

not working

You broke rule number 1 of the “Unwritten rules of the Facepunch Lua Help section”.

Never ever say it’s not working WITHOUT posting some kind of error message or explaining the problem.

sorry for that

there are file create after use http.get

Works for me.

The function is threaded as far as I can tell and only runs the callback function once it’s finished.

This means that the game needs to be running and active ( running Tick / Think ) to do anything.

Single player: Close the console after running it or the script
Listen Server: Should work as normal
Dedicated Server: I think you need a player on the server for it to work.