Child pages
  • Poster
Skip to end of metadata
Go to start of metadata


Method Summery
Boolean #addFile(parameterName, fileName, fileLocation)
Add a file to the post.
Boolean #addHeader(headerName, value)
Adds a header to the request.
Boolean #addParameter(name, value)
Add a parameter to the post.
Number #doPost([username], [password])
Do the actual post.
String #getPageData()
Get the result page data after a post.
void #setCharset(charset)
Set the charset used when posting.

Method Details
addFile

Boolean addFile (parameterName, fileName, fileLocation)

Add a file to the post.
Parameters
parameterName
fileName
fileLocation
Returns
Boolean
Sample
poster.addFile('myFileParamName','manual.doc','c:/temp/manual_01a.doc')
poster.addFile(null,'postXml.xml','c:/temp/postXml.xml') // sets the xml to post
addHeader

Boolean addHeader (headerName, value)

Adds a header to the request.
Parameters
headerName
value
Returns
Boolean
Sample
poster.addFile(null,'postXml.xml','c:/temp/postXml.xml') // sets the xml to post
poster.addHeader('Content-type','text/xml; charset=ISO-8859-1')
addParameter

Boolean addParameter (name, value)

Add a parameter to the post.
Parameters
name
value
Returns
Boolean
Sample
poster.addParameter('name','value')
poster.addParameter(null,'value') //sets the content to post
doPost

Number doPost ([username], [password])

Do the actual post.
Parameters
[username]
[password]
Returns
Number
Sample
var httpCode = poster.doPost()
getPageData

String getPageData ()

Get the result page data after a post.
Returns
String
Sample
var pageData = poster.getPageData()
setCharset

void setCharset (charset)

Set the charset used when posting. If this is null or not called it will use the default charset (UTF-8).
Parameters
charset
Returns
void
Sample
var poster = plugins.http.getPoster('https://twitter.com/statuses/update.json');
poster.addParameter('status',globals.textToPost);
poster.addParameter('source','Test Source');
poster.setCharset('UTF-8');
var httpCode = poster.doPost(globals.twitterUserName, globals.twitterPassword); //httpCode 200 is ok
  • No labels