I have the following PHP/CURL. I need to send it via JS/AJAX (Axios)
How to adapt to JS?
$username = 'test';
$password = 'test';
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, 'https://example.com/pc_api/index.php/token');
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_handle, CURLOPT_USERPWD, $username . ':' . $password);
curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);