3

Magento Framework has 2 classes for Curl operations:

\Magento\Framework\HTTP\Adapter\Curl and

\Magento\Framework\HTTP\Client\Curl

What is specific use-case for each as both are capable of doing same job ?

1 Answer 1

1

NOT THE ACTUAL ANSWER

  • Both classes are curl based wrapper classes.
  • Tasks of the both classes remains the same such as connecting, writing, reading and closing connection to the server but in different way.

Adapter CURL

  • Used as connector for Zend_Http_Client which has a internal framework - dependency on request type and response.
  • Common method for GET/POST/DELETE/PUT
  • First writes the request to the remote server using write() method and read the response using read() method.

Client CURL

  • Class to work with HTTP protocol which directly calls curl lib, no dependency on Framework Zend or Laminas.
  • Different method for GET/POST, separate methods available get() and post()
  • For other methods(PUT/DELETE) one has to trigger - method makeRequest()

I would say to implement the code using Client CURL class only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.