php-mod / curl

This library provides an object-oriented and dependency free wrapper of the PHP cURL extension.
MIT License
328 stars 120 forks source link

add CURLOPT_CUSTOMREQUEST for get/post function #85

Closed mean-cj closed 2 years ago

nadar commented 2 years ago

Hi @mean-cj

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

mean-cj commented 2 years ago

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.

nadar commented 2 years ago

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.