How to insert a record into appery database using PHP?

Here is what I am trying:
I created a database within Appery. I am now trying to access the data using PHP. I am able to read from the database successfully. I am nowtrying to insert a record into a table. Here is a code snippet:
$curl = curl_init();

$header[] = "X-Appery-Database-Id: XXXXXXXXXX";
$header[] = "X-Appery-Session-Token: XXXXXXXXXXXXXX";
$header[] = "Content-Type: application/json";

$tuple = '{"address": "XXXX", "mapLocation":"[33.123456, -111.123456]"}';

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $tuples);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);

$html = curl_exec($curl);

Can you please help?
1 person has
this question
+1
Reply