From d9aaea928c5479303749e7e7f55c04f08f8ee0e2 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 19 Sep 2022 06:27:03 +0000 Subject: [PATCH] Add call to curl to command. #704 --- src/Command/LoadWarrantySerialCommand.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Command/LoadWarrantySerialCommand.php b/src/Command/LoadWarrantySerialCommand.php index c4e35af5..41fcb15d 100644 --- a/src/Command/LoadWarrantySerialCommand.php +++ b/src/Command/LoadWarrantySerialCommand.php @@ -378,6 +378,26 @@ class LoadWarrantySerialCommand extends Command error_log(print_r($json_output, true)); // TODO: sent json output somewhere + + $curl = curl_init(); + + $options = [ + CURLOPT_URL => $this->base_url . '/' . $url, + CURLOPT_POST => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POSTFIELDS => $body, + CURLOPT_HTTPHEADER => [ + 'Content-Type: application/json', + 'Ocp-Apim-Subscription-Key: ' . $this->sub_key, + 'Authorization: Bearer ' . $this->token, + ], + ]; + + curl_setopt_array($curl, $options); + $res = curl_exec($curl); + + curl_close($curl); + } }