POSTing with GM_xmlhttpRequest

Subscribe to POSTing with GM_xmlhttpRequest 2 posts, 2 voices

 
simon! Scriptwright

http://traviantool.ww7.be/new_travian/frigot.ph...

Is what the url SHOULD look like, if it were only that simple! It seems it has to be either referring from the original page or actively requires a submission. The frigot.php form is also the page that returns the results once it's been submitted. Is this possible with GM_xmlhttpRequest? I know you can GET with it, but haven't seen any code with regards to posting.

 
Adrian Scriptwright

You can definitely do a POST request with GM_xmlhttpRequest. Here's an example:

GM_xmlhttpRequest({
	method:'POST',
	url: 'http://traviantool.ww7.be/new_travian/frigot.php',
	headers: {'Content-type': 'application/x-www-form-urlencoded'},
	data: 'lang=com&serveur=new_s3_com&coord_x=20&coord_y=419&p_max=0&Rayon=25',
	onload: MyCallback,
});

Note the "Content-type" header and the data field. This example should turn the URL above into a POST instead of a GET.