Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting a POSTMAN request to Curl

Tags:

php

curl

postman

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

like image 349
Coder Avatar asked Mar 22 '18 15:03

Coder


People also ask

What is the equivalent of cURL in Postman?

When it comes to REST APIs, we can use Postman as a GUI (graphical user interface) and cURL as a CLI (command line interface) to do the same tasks.

Does Postman support cURL?

The good news is, Postman can help make cURL easier to use. We do that in two ways. An easier way to create cURL commands. You can construct a request in Postman and convert it to cURL using the code snippet generator.


1 Answers

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

like image 144
Jose M. González Avatar answered Sep 22 '22 01:09

Jose M. González