I am calling third party API using below methods:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->_url . 'api/v1/ShipTos');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer $session", "Content-Length: " . strlen($data_string)));
$out = curl_exec($ch);
How to call curl method in Magento 2 with example please?