Hallo.
I'd like to post data from a Firefox extension.
The HTML-Formular I want to fake looks like this
<form action="http://homepage/phpinfo.php" method="post">
<input name="name" value="foo">
<input name="id" value="bar">
</form>
The code I use is this:
var body = '\r\nname=foo&id=bar\r\n';
var webNav =
_content.QueryInterface(Components.interfaces.nsII nterfaceRequestor).
getInterface(Components.interfaces.nsIWebNavigatio n);
var sis = Components.classes["@mozilla.org/io/string-input-stream;1"].
createInstance(Components.interfaces.nsIStringInpu tStream);
sis.setData(body, body.length);
document.getElementById("content").webNavigation.l oadURI('http://homepage/phpinfo.php',
0, null, sis, null);
The requested page is opened and displayed. But there is no post data at
all.
Now I've installed the Firefox-Extension tamper to monitor the HTTP-Header.
For the HTML-Formular the table of the post-parameter looks like this:
Name: Value:
name foo
id bar
For my loadURI-request:
Name: Value:
POST_DATA name=foo&id=bar
So there seems to be something wrong. But I can't figure out what's
wrong and how to fix it. Do you have any suggestions?
Thanks for your help.
Greetings,
Björn