Converting a POSTMAN request to Curl

PhpCurlPostman

Php Problem Overview


I am calling my java webservice (POST request) via POSTMAN in the following manner which works perfectly fine (i.e. I can see my records getting inserted into the database):

enter image description here

And, here's how the contents inside the Headers(1) tab looks like:

enter image description here

Instead of calling it via POSTMAN, I have to call the same request in PHP using CURL. I am wondering if there's a way to export this command to curl command so that I could use it in my PHP code? I have found opposite approach at many places online where someone is asking to convert Curl based request to POSTMAN but couldn't figure out how to do the opposite.

Some articles I found for curl to postman

Php Solutions


Solution 1 - Php

Open code window

You can see the button "Code" in the attached screenshot, press it and you can get your code in many different languages including PHP cURL

Code snippets window

Edited: As other answers said Postman UI was updated, I change the images accordingly

Solution 2 - Php

Starting from Postman 8 you need to visit here

enter image description here

Solution 3 - Php

The first answer here works with the older versions of Postman. With the latest releases in 2021 the cURL can be found clicking this icon (circled in red) enter image description here

Solution 4 - Php

If you're like me running MacOS and still have Postman v7, you have to click the ellipses here to find the code option

Solution 5 - Php

Here is a quick video demonstration postman request to curl

Latest version 8.x:

  • Find Code symbol on the right side of the postman. enter image description here

  • Select cURL from the dropdown. enter image description here

Solution 6 - Php

enter image description hereTo extend the existing answers, there is an option to generate PHP ready cURL code if needed. With latest Postman, you will find dropdown for PHP - cURL and other languages.

See screenshot:

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCoderView Question on Stackoverflow
Solution 1 - PhpJose M. GonzálezView Answer on Stackoverflow
Solution 2 - PhpArtem BernatskyiView Answer on Stackoverflow
Solution 3 - Phpvivekagarwal277View Answer on Stackoverflow
Solution 4 - PhpTheFreddyKiloView Answer on Stackoverflow
Solution 5 - PhpVeKeView Answer on Stackoverflow
Solution 6 - PhpDeepak RajpalView Answer on Stackoverflow