Http Class

From DevWiki

Jump to: navigation, search

Back to API Reference


Contents


Http

Get the object handle for Http
http = mc.Http()


Download

bool Download(string url, string localPath)
Download a file.
bool = http.Download('http://url.com/to/my/file.png', myTempDir)


Get

string Get(string url)
Perform an HTTP GET request
data = http.Get('http://boxee.tv/')


GetHttpHeader

string GetHttpHeader(string key)
Retrieves an http header from the reqponse
data = http.Get('http://boxee.tv/')
print http.GetHttpHeader('location')


GetHttpResponseCode

int GetHttpResponseCode(void)
Get the http response code from the operation
data = http.Get('http://boxee.tv/')
if http.GetHttpResponseCode() == 400:
   print 'Response code 400!


Post

string Post(string url, string urlEncodedPostData)
Perform an HTTP POST request
params = "login="+user+"&password="+password+"&method=login"
data = http.Post('http://mysite.com/login', params)


Reset

void Reset(void)
Reset the Http object - all data will re-initialize
http.Reset()


SetHttpHeader

void SetHttpHeader(string key, string value)
Set a request http header
http.SetHttpHeader('WWW-Authenticate', 'Negotiate')


SetUserAgent

void SetUserAgent(string userAgent)
Set the user-agent value to use
http.SetUserAgent('Boxee/Beta')
Personal tools