<?php

if ($_SERVER["REQUEST_METHOD"] != "POST") {
  exit();
}

function _isCurl(){
  return function_exists('curl_version');
}

//if (is_file(realpath('../system/index.php'))) {
  //require_once(realpath('../system/index.php'));
//}

header('Content-Type: application/json');

try {
  // retrieve JSON from POST body
  /*$json_str = file_get_contents('php://input');
  $json_obj = json_decode($json_str);

  $sql = "INSERT INTO upgrades_stripe (activation_date, subscription_id, current_period_end, customer, price_item_id, imei) VALUES ( '".time()."','".$json_obj->stripePyment->subscriptionId."','".$json_obj->stripePyment->currentPeriodEnd."','".$json_obj->stripePyment->customer."','".$json_obj->stripePyment->priceItemId."','".$json_obj->imei."' )";

  $query = $db->query($sql);
  $id = $db->getLastId();  //get current user id

  echo json_encode(['id'=>$id]);*/
  echo json_encode(['id'=>1]);
} catch (Error $e) {
  http_response_code(500);
  echo json_encode(['error' => $e->getMessage()]);
}