I am using event
customer_register_success for sending customer detail to a third party website. I am facing problem in implementation of CURL in event observer. Do you have any example of using
CURL in a magento 2 observer?
I dont think its a good practice but you can follow below code in you observer for your requirement.
$ch = curl_init(); //pass your arguments in array $request = array( 'USER' => $user, 'PWD' => $pwd, 'SIGNATURE' => $signature, 'METHOD' => 'RefundTransaction', 'VERSION' => urlencode($version) ); $api = "Your Api Url here"; curl_setopt($ch, CURLOPT_URL, $api); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($request)); //here curl request will be sent $curlResponse = curl_exec($ch);
You can get your response in