Asked  7 Months ago    Answers:  5   Viewed   46 times

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



enter image description here

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

enter image description here

Wednesday, March 31, 2021
answered 7 Months ago

You should only call curl_close() when you know you're done with that particular handle, or if switching from its current state to a new one (ie: changing a ton of options via curl_setopt() would be faster by going from a clean new handle than your current "dirty" one.

The cookiejar/file options are only strictly necessary for maintaining cookies between seperate curl handles/invokations. Each one's independent of the others, so the cookie files are the only way to share between them.

Wednesday, March 31, 2021
answered 7 Months ago

You need to add the Curl libraries to the command line PHP.ini.

You can probably just copy the file C:wampbinapacheApache2.2.xbinphp.ini to c:wampbinphpphp5.3.10php.ini (adjust for the actual directories on your system).

Wednesday, March 31, 2021
answered 7 Months ago

I guess there's no such feature in postman as to run concurrent tests.

If i were you i would consider Apache jMeter which is used exactly for such scenarios.

Regarding Postman, the only thing that could more or less meet your needs is - Postman Runner. enter image description here There you can specify the details:

  • number of iterations,
  • upload csv file with data for different test runs, etc.

The runs won't be concurrent, only consecutive.

Hope that helps. But do consider jMeter (you'll love it).

Thursday, July 8, 2021
answered 4 Months ago

Swift 2.x:

typealias apiSuccess = (result: NSDictionary?) -> Void
typealias apiProgress = (result: NSDictionary?) -> Void // when you want to download or upload using Alamofire..
typealias apiFailure = (error: NSDictionary?) -> Void

// Normal http request with JSON response..
func callJSONrequest(url:String, params:[String: AnyObject]?, success successBlock :apiSuccess,
                     failure failureBlock :apiFailure) {

    Alamofire.request(.POST, url, parameters: params, encoding: ParameterEncoding.URL)
        .responseJSON { response in
            print("(response.request?.URL)")  // original URL request
            //print(response.response) // URL response
            //print(     // server data
            //print(response.result)   // result of response serialization
            if response.result.isSuccess {
                let jsonDic = response.result.value as! NSDictionary
                successBlock(result: jsonDic)

            } else {
                let httpError: NSError = response.result.error!
                let statusCode = httpError.code
                let error:NSDictionary = ["error" : httpError,"statusCode" : statusCode]
                failureBlock(error: error)

func myFunction() {
    let myApiSuccess: apiSuccess = {(result: NSDictionary?) -> Void in
        print ("Api Success : result is:n (result)")
        // Here you can make whatever you want with result dictionary

    let myApiFailure: apiFailure = {(error: NSDictionary?) -> Void in
        print ("Api Failure : error is:n (error)")
        // Here you can check the errors with error dictionary looking for http error type or http status code
    var params :[String: AnyObject]?
    let email : String! = ""
    let password : String! = "thisismypassword"
    params = ["email" : email, "password" : password]
    let url : String! = ""
    callJSONrequest(url, params: params, success: myApiSuccess, failure: myApiFailure)
Wednesday, September 1, 2021
Tito Sanz
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :