Invoice Ninja hello. I’m trying to connect to your API using a CURL request. The current iteration of my code is lifted straight from your very own SDK wrapper (specifically the sendRequest method in bstractModel.php). This is how it looks:
$type = 'GET';
$token = 'myTokenGoesHere';
$curl = curl_init();
$opts = [
CURLOPT_URL => 'https://app.invoiceninja.com/api/v1/clients',
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_CUSTOMREQUEST => $type,
CURLOPT_POST => $type === 'POST' ? 1 : 0,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-Ninja-Token: '. $token,
],
];
curl_setopt_array($curl, $opts);
$response = curl_exec($curl);
curl_close($curl);
This call is supposed to return a list of all the customers, but instead is returning Boolean false. I know my token is correct because I’m able to view correct results when using CURL from the command line. However, it does not work using the above PHP code. Can you please have a look and let me know if I’m missing something here?