http.Get
From GMod Wiki
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: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Http.Get]Http.Get [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Prints the size and the contents of an HTTPConnection object. |
---|---|
Used on | |
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 - |
Additional Notes
- Note that while in http.Get the arguments come after the other parameters, the arguments table is first in the callback function.
- Will normally give the source of the page, but will ocassionaly give HTTP headers.
- To fix these problems, a bug report has been opened.