I am calling third party API using below methods:
public function setCredentials($data)
{
$curl = curl_init('https://example_url.com/');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
}
i have tried some of the examples here but I still get errors. How to curl in magento 2?