【发布时间】:2017-11-25 14:00:45
【问题描述】:
我有以下 PHP/CURL。我需要通过 JS/AJAX (Axios) 发送它
如何适应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);
【问题讨论】:
-
我认为这可以解决您的问题:stackoverflow.com/questions/5507234/…
标签: ajax ssl curl passwords axios