How to reset CURLOPT_CUSTOMREQUEST

后端 未结 3 1849
被撕碎了的回忆
被撕碎了的回忆 2021-01-11 12:12

I’m using a REST API which, among other things, uses the DELETE method like this:

DELETE /resources/whatever/items/123

To acce

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-11 12:31

    (Shrug ...) And what I wound up doing in my API is to simply, "set it every time." My POST routine simply sets a custom-header of "POST", and so on. Works great.

    I found that, once you do set a custom-header, it "sticks." Future calls which then attempt to do ordinary GET, POST, PUT start to fail. I experimented with the suggestions listed earlier in this post (with PHP-7), and didn't very-quickly meet with success ... so: "to heck with it, this isn't elegant, but it works."

提交回复
热议问题