Eleven Different Ways – How to make one HTTP POST Request

HOW to make a post request
If you are a developer, you might already know what an HTTP POST request is. You are pretty comfortable in making one. The probability that your present project is somehow related to one or more HTTP post requests, is pretty damn high. Most of the modern applications interact with a server. Here I will show different ways of making a post request in different languages.

 

How to make HTTP POST Request using cURL

We programmers love to read codes. So I will directly jump into code. Here is the code snippet you can run in your terminal to make one POST request using curl.

How to make HTTP POST Request using jQuery AJAX

How to make HTTP POST Request using HTML5 Fetch API

How to make HTTP POST Request using XMLHttpRequest

How to make HTTP POST Request in NodeJS using Native Http Module

How to make HTTP POST Request in NodeJs using Request NPM Package

How to make HTTP POST Request in PHP (HttpRequest)

How to make HTTP POST Request in PHP (cURL)

How to make HTTP POST Request in python3

How to make HTTP POST Request in python (requests module)

How to make HTTP POST Request in JAVA using OkHttp Library

I hope that you enjoyed reading the code as same as me I did while writing them. I will try to update this article as I get to learn more about other languages. I have an advice for you. Please stop using XMLHttpRequest, rather use Fetch API.

If you like to contribute here, kindly leave a comment. Thank you.

5 thoughts on “Eleven Different Ways – How to make one HTTP POST Request

  1. Nice overview. Here’s how you could do it in Perl:

    use HTTP::Request::Common;
    use LWP::UserAgent;

    print LWP::UserAgent->new
    ->request(POST ‘http://example.com/api/auth’,
    Content_Type => ‘application/json’,
    Content => ‘{“email”:”sandeep@applyhead.com”,”password”: “12345678”}’)
    ->decoded_content;

Leave a Reply

Your email address will not be published. Required fields are marked *