我试图通过使用托管 REST 完整 API 来调用身份验证 API。但是,我没有从身份验证 API 获得任何有效响应。
我使用 Codeigniter CURL 方法通过 URL https://stgsecureapi.escrow.com/api/Transaction发布变量, 但它仍然不适合我。
我收到以下回复:身份验证被拒绝
如果有人有解决这个问题的想法,请帮助我。
我正在使用的代码:
//The JSON data.
$url = 'https://stgsecureapi.escrow.com/api/Transaction';
$jsonData = array(
'username' => '*****@gmail.com',
'password' => '****',
'pid' => '***'
);
//Encode the array into JSON.
$jsonDataEncoded = json_encode($jsonData);
print_r($jsonDataEncoded);
// Start session (also wipes existing/previous sessions)
$this->curl->create($url);
// Option
$this->curl->option(CURLOPT_HTTPHEADER, array('Content-type: application/json; Charset=UTF-8'));
// Post - If you do not use post, it will just run a GET request
$this->curl->post($jsonDataEncoded);
// Execute - returns responce
$this->data['curlreturn'] = $this->curl->execute();
//exit;
$this->load->view('pay/pay', $this->data);