curl icon indicating copy to clipboard operation
curl copied to clipboard

add CURLOPT_CUSTOMREQUEST for get/post function

Open mean-cj opened this issue 3 years ago • 2 comments

mean-cj avatar May 18 '22 07:05 mean-cj

Hi @mean-cj

Whats to benefit of introducing this? What does it change? Could you please elaborate?

nadar avatar Jul 29 '22 09:07 nadar

Hi nada

When we need to call $curl->get() after $curl->post() , curl option "CURLOPT_CUSTOMREQUEST" doesn't work because curl option remember CURLOPT_CUSTOMREQUEST = POST

fixed add $this->setOpt(CURLOPT_CUSTOMREQUEST, "GET"); into the get method.

mean-cj avatar Jul 29 '22 09:07 mean-cj

When you change the request method by setting CURLOPT_CUSTOMREQUEST to something, you do not actually change how libcurl behaves or acts in regards to the particular request method, it will only change the actual string sent in the request.

nadar avatar Aug 29 '22 08:08 nadar