Hi,
I’m not deleting my question, simply for future reference.
But the problem was in fact with the documentation, just a small mistake in https://backendless.com/documentation/data/php/data_saving_data_objects.htm as
Backendless::initApp('YOUR-REST-SECRET-KEY', 'YOUR-APPLICATION-ID', 'v1');
where it should be
Backendless::initApp('YOUR-APPLICATION-ID', 'YOUR-REST-SECRET-KEY', 'v1');
Best,
~ Fatih
•••
Original Question / Problem:
I already checked other threads related to this issue but they didn’t help.
Now, following code works as expected :
<?php
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1
header("Pragma: no-cache"); // HTTP 1.0
header("Expires: 0"); // Proxies
$url = 'https://api.backendless.com/v1/data/Users';
$headers = array(
"Content-Type:application/json",
"application-id:" . kpBACKENDLESS_APP_ID,
"secret-key:" . kpBACKENDLESS_REST_KEY
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
var_dump( $result );
?>
Yet, this one throws the error in the subject line :
<?php
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1
header("Pragma: no-cache"); // HTTP 1.0
header("Expires: 0"); // Proxies
require_once (kpPATH_TO_LIBS . "/Backendless/backendless/autoload.php");
use backendless\Backendless;
try {
Backendless::initApp( kpBACKENDLESS_REST_KEY, kpBACKENDLESS_APP_ID, kpBACKENDLESS_APP_VERSION );
} catch (Exception $e) {
echo $e->getMessage();
// Prints Error 2002 and its description
}
?>
Just guide me to the right direction to find out the source of problem, where should I look, what should I debug?
Thanks,
~ Fatih