VM暫存
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.8KB

  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. require_once('/home/bigbang/libs/phplibs/phpMQTT.php');
  4. class Parking_inseat_api extends CI_Controller {
  5. public function __construct() {
  6. parent::__construct();
  7. $this->load->model('reports/Update_pks_groups_model','update_pks_groups');
  8. }
  9. public function index()
  10. {
  11. $station_no="40705";
  12. $group_id="P1";
  13. $sel_pks_groups_group_id=$this->update_pks_groups->sel_pks_groups_group_id($station_no,$group_id);
  14. $floors=isset($sel_pks_groups_group_id[0]['floors']) ? $sel_pks_groups_group_id[0]['floors'] : '' ;
  15. $station_no=isset($sel_pks_groups_group_id[0]['station_no']) ? $sel_pks_groups_group_id[0]['station_no'] : '' ;
  16. $tot=isset($sel_pks_groups_group_id[0]['tot']) ? $sel_pks_groups_group_id[0]['tot'] : '' ;
  17. $parked=isset($sel_pks_groups_group_id[0]['parked']) ? $sel_pks_groups_group_id[0]['parked'] : '' ;
  18. $spare=isset($sel_pks_groups_group_id[0]['availables']) ? $sel_pks_groups_group_id[0]['availables'] : '' ;
  19. $type=isset($sel_pks_groups_group_id[0]['type']) ? $sel_pks_groups_group_id[0]['type'] : '' ;
  20. $datetime=date('Y-m-d H:i:s'); ;
  21. $data=array(
  22. "floors" => $floors,
  23. "station_no" => $station_no,
  24. "tot" => $tot,
  25. "parked" => $parked,
  26. "spare" => $spare,
  27. "type" => $type,
  28. "datetime" => $datetime
  29. );
  30. $apijson= "http://altapi.altob.com.tw/api/Parking_inseat_api";
  31. $ch = curl_init();
  32. curl_setopt($ch, CURLOPT_HEADER, 0);
  33. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  34. curl_setopt($ch, CURLOPT_URL, $apijson);
  35. curl_setopt($ch, CURLOPT_POST, true);
  36. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
  37. $output = curl_exec($ch);
  38. curl_close($ch);
  39. print_r($output);exit;
  40. }
  41. }