Firebug: how to send POST data to firebug console?

Can I send data to the server using POST?

Ie) I want to send POST data to url:

http://www.a.com/b?cmd=tt 

With POST data:

 a=1 b=2 

Is it doable and how?

+8
javascript html firebug
Jul 21 '12 at 5:24
source share
3 answers

A quote from Mike Cooper on a similar subject:

As far as I know, Firebug cannot do this. However, there is a very useful Firebug-like Firefox extension called Tamper Data . This should be able to do what you want.

It allows you to track every request made by the browser, and you can enable an option that allows you to view and edit each individual request before sending it.

See other answers in the source: How to make POST on a web page using Firebug?
Also see: Using Firebug to Submit Form Data




The above work, if you just want to modify HTTP requests, but to actually create HTTP requests, there is a Firefox extension called Poster that has the following description:

A developer tool for interacting with web services and other web resources that allows you to make HTTP requests , set the object body and content type. This allows you to interact with web services and check the results ...

+8
Jul 21 '12 at 5:26
source share

In fact, now you can (starting from Firefox 3.5) make a pure XHR POST from Firebug, to any domain, you just like it in pure JavaScript on the page, with the theme of the same limitations.

The code is a little long and incompatible, although if you want to use it often (if you do not store it and copy it, paste it every time)

Paste into the console (it will automatically open the command editor, since it is> 1 line)

 var xhr = new XMLHttpRequest(); xhr.open("POST", "http://test/xhrtest.php?w=www"); xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhr.send("a=aaa&b=bbb"); 

Remember that on the server side you must enable CORS in order to see the response in Firebug (otherwise the request will be sent, but you will not see the answer in Firebug, you can see it in Fiddler , though); if you opened Firebug when you are on the page http://foo/somepage , then this URL will be sent to XHR in the header field of the HTTP referrer, and this domain should be allowed to receive XHR responses through the Access-Control-Allow-Origin header , which you can either install in the server configuration or directly on the page.

Example in PHP:

 <?php header('Access-Control-Allow-Origin: *'); //you can adjust it more fine-grained, perhaps in an 'if' //header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']); //header('Access-Control-Allow-Origin: http://foo'); echo $_POST['a'] . "\r\n"; echo $_POST['b'] . "\r\n"; echo $_GET['w'] . "\r\n"; ?> 

You can then use the Firebug Net tab to check the response (and also on the Console tab if you have the Console > RIGHT CLICK > Show XMLHttpRequest option enabled).

+12
Jul 22 2018-12-22T00:
source share

No plugins needed.

You can simply do this with the built-in javascript button: https://stackoverflow.com/a/166778/

0
Jul 28 '16 at 18:04
source share



All Articles