const Cc = Components.classes;
const Ci = Components.interfaces;
var stringStream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.nsIStringInputStream);
var URL= "http://www.example.com/search/search.php";
var dataString="srch=true"+"&searchtype="+searchTerms;
if ("data" in stringStream)
stringStream.data = dataString;
else
stringStream.setData(dataString, dataString.length);
var postData = Cc["@mozilla.org/network/mime-input-stream;1"].createInstance(Ci.nsIMIMEInputStream);
postData.addHeader("Content-Type", "application/x-www-form-urlencoded");
postData.addContentLength = true;
postData.setData(stringStream);
loadURI(URL,null,postData);
No comments:
Post a Comment