Difference between revisions of "HttpRequest class"

From Catglobe Wiki
Jump to: navigation, search
Line 12: Line 12:
  
 
'''string ContentType HasGetter HasSetter''' - Get/Set the ContentType<br>'''Dictionary Headers HasSetter''' - Apply headers to the request<br>'''string Method HasGetter HasSetter''' - Choose which HTTP method to request with<br>'''string ObjectTypeName HasGetter''' - The name of the type of object.<br>'''number Timeout HasGetter HasSetter''' - Get/Set the timeout (in millisec)<br>'''TypeInformation TypeInformation HasGetter''' - Get information about this class.<br>  
 
'''string ContentType HasGetter HasSetter''' - Get/Set the ContentType<br>'''Dictionary Headers HasSetter''' - Apply headers to the request<br>'''string Method HasGetter HasSetter''' - Choose which HTTP method to request with<br>'''string ObjectTypeName HasGetter''' - The name of the type of object.<br>'''number Timeout HasGetter HasSetter''' - Get/Set the timeout (in millisec)<br>'''TypeInformation TypeInformation HasGetter''' - Get information about this class.<br>  
 +
 +
<br>
 +
 +
'''For more information about an HTTP Message:''' [http://www.jmarshall.com/easy/http/ http://www.jmarshall.com/easy/http/]<br>
  
 
==== <span style="color:#a52a2a;">Examples</span>  ====
 
==== <span style="color:#a52a2a;">Examples</span>  ====

Revision as of 12:34, 15 September 2011

HttpRequest : Object to make requests to sites

Constructors

(string uri (The uri to visit.)) - Visit a uri
(string uri (The uri to visit.), WebResponse takeCookiesFrom (If you made a previous request and want to transfer the cookies from that response, give the response object here.)) - Visit a uri with cookies

Methods

WebResponse GetResponse() - Actually do the request, and get the response back
WebResponse GetResponse(string body (A body to include in the request - Always UTF-8 encoded)) - Actually do the request, and get the response back
string ToString() - The string representation of the object.

Properties

string ContentType HasGetter HasSetter - Get/Set the ContentType
Dictionary Headers HasSetter - Apply headers to the request
string Method HasGetter HasSetter - Choose which HTTP method to request with
string ObjectTypeName HasGetter - The name of the type of object.
number Timeout HasGetter HasSetter - Get/Set the timeout (in millisec)
TypeInformation TypeInformation HasGetter - Get information about this class.


For more information about an HTTP Message: http://www.jmarshall.com/easy/http/

Examples

string uri = "http://google.com";
string responseString;
HttpRequest hr = new HttpRequest(uri);
WebResponse wr = hr.GetResponse();  
responseString = wr.Response();
print(responseString);