http.Get

From GMod Wiki

Jump to: navigation, search
Function
Syntax http.Get( String URL, String headers, Function callback, Var ... arguments )
Where is this used?
Description:
Returns a HTTPConnection object
Returns: HTTPConnection
Part of Library: Http
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Http.Get]Http.Get [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionPrints the size and the contents of an HTTPConnection object.
Used onNewerShared.png
Code
 
function httpCallBack(contents , size)
	Msg("Size: "..size.."\nContents: "..contents.."\n")
end
http.Get("http://youtube.com", "", httpCallBack) 
 
Output
Size: 94718
		Contents: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
		<html lang="en" dir="ltr">
		<!-- machid: WkFSZzctYUFHdmlfVGt4cUNWbTdJLTFLaDFTMHBaWkJQMEk3cGowMlYzaGZPTW42YXVCQmRR -->
		<head>
				<title>
				YouTube- Broadcast Yourself.
				</title>
				<link id="www-core-css" rel="stylesheet" href="http://s.ytimg.com/yt/cssbin/www-core-vfl141990.css">
						<link rel="alternate" type="application/rss+xml" title="YouTube -


DescriptionDemonstrates the use of http.Get arguments
Used onNewerShared.png
Code
 
function httpCallBack(args, contents , size)
	PrintTable(args)
end
http.Get("http://youtube.com", "", httpCallBack, 5, "String", 664) 
 
Output
1	=	5
2	=	String
3	=	664


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox