addwork.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <input type="text" name="series">
  2. <input type="text" name="number">
  3. <input type="text" name="subnumber">
  4. <input type="text" name="diagnosticMap">
  5. <input type="text" name="sectionId">
  6. <input type="text" name="kind" value="ТР-1">
  7. <?php
  8. $series = $_REQUEST["series"];
  9. $number = $_REQUEST["number"];
  10. $subnumber = $_REQUEST["subnumber"];
  11. $series = $_REQUEST["diagnosticMap"];
  12. $series = $_REQUEST["sectionId"];
  13. $kind = $_REQUEST["kind"];
  14. $url = $_SERVER['SERVER_NAME'].'/api/service/addwork';
  15. //$url = $_SERVER['SERVER_NAME'].'/api/service/checkrfid';
  16. $key = '07a13c8907d1-6a7bdba1-a2fz-aatgu4j';
  17. //{"PlaceOfRepair":"bbdac35c-629f-11e1-930e-001517e6ca10",
  18. //"TypeOfRepair":"ТР-1",
  19. //"HomeDepot":"fc73e6a5-6a02-11e2-9410-ac162db0b20c",
  20. //"SectionNumber":"0026Б",
  21. //"DiagnosticMapslocomotive":"3313f3d0-5f6b-11e9-80d0-005056011052",
  22. //"LocomotiveNumber":"ЧС7",
  23. //"RepairStartDatePlan":"2019-04-19T07:00:00",
  24. //"Section":"2e7ba168-f04a-11e1-8e8b-001517e6ca10",
  25. //"SectionSubnumber":"12020517",
  26. //"LocomotiveSeries":"8c5d1a77-4649-11e1-b72e-001517e6ca10",
  27. //"RepairStartDateFact":"0001-01-01T00:00:00"}
  28. $jsonEncoded = json_encode(
  29. [
  30. "series" => "ЧС7",
  31. "number"=>"0026Б",
  32. "subnumber"=>"12020517",
  33. "diagnosticCard"=>"3313f3d0-5f6b-11e9-80d0-005056011052",
  34. "rfid"=>"2545856584",
  35. "kind"=>"ТР-1",
  36. "dateTime" => "1562077752",
  37. "sectionId"=>"2e7ba168-f04a-11e1-8e8b-001517e6ca10",
  38. ]);
  39. //{"PlaceOfRepair":"bbdac35c-629f-11e1-930e-001517e6ca10",
  40. // "TypeOfRepair":"ТР-1",
  41. // "HomeDepot":"fc73e6a5-6a02-11e2-9410-ac162db0b20c",
  42. // "SectionNumber":"0026Б",
  43. // "DiagnosticMapslocomotive":"3313f3d0-5f6b-11e9-80d0-005056011052",
  44. // "LocomotiveNumber":"ЧС7",
  45. // "RepairStartDatePlan":"2019-04-19T07:00:00",
  46. // "Section":"2e7ba168-f04a-11e1-8e8b-001517e6ca10",
  47. // "SectionSubnumber":"12020517",
  48. // "LocomotiveSeries":"8c5d1a77-4649-11e1-b72e-001517e6ca10",
  49. // "RepairStartDateFact":"0001-01-01T00:00:00"}
  50. //
  51. //{"PlaceOfRepair":"bbdac35c-629f-11e1-930e-001517e6ca10","TypeOfRepair":"ТР-1","HomeDepot":"fc73e6a6-6a02-11e2-9410-ac162db0b20c",
  52. // "SectionNumber":"0223Б",
  53. // "DiagnosticMapslocomotive":"63cfbb77-9ed3-11e8-80cf-005056011052",
  54. // "LocomotiveNumber":"ЧС7","RepairStartDatePlan":"2018-08-16T07:00:00",
  55. // "Section":"34d11b7c-f04a-11e1-8e8b-001517e6ca10",
  56. // "SectionSubnumber":"12024469",
  57. // "LocomotiveSeries":"8c5d1a77-4649-11e1-b72e-001517e6ca10",
  58. // "RepairStartDateFact":"0001-01-01T00:00:00"}
  59. //
  60. //{"PlaceOfRepair":"bbdac35c-629f-11e1-930e-001517e6ca10",
  61. // "TypeOfRepair":"ТР-1","HomeDepot":"fc73e6a6-6a02-11e2-9410-ac162db0b20c",
  62. // "SectionNumber":"0275А",
  63. // "DiagnosticMapslocomotive":"befe3b99-132a-11e9-80cf-005056011052",
  64. // "LocomotiveNumber":"ЧС7","RepairStartDatePlan":"2019-01-11T07:00:00",
  65. // "Section":"3c0afed3-5c25-11e3-9702-ac162db0b20c",
  66. // "SectionSubnumber":"12025490",
  67. // "LocomotiveSeries":"8c5d1a77-4649-11e1-b72e-001517e6ca10",
  68. // "RepairStartDateFact":"0001-01-01T00:00:00"}
  69. //$jsonEncoded = json_encode(
  70. // [
  71. // "locomotive_serie" => "2ЭС5К",
  72. // "number"=>"0275А",
  73. // "subnumber"=>"12025490",
  74. // "diagnosticMap"=>"004d9e52-9848-11e9-80d5-005056011052",
  75. // "typeOfRepair"=>"ТР-1",
  76. // "dateTime" => "1562077752",
  77. // "sectionId"=>"34d11b7c-f04a-11e1-8e8b-001517e6ca10",
  78. // "PP-5dbc36ea-47e9-472f-ba17-b45422fc25ac"=>array()
  79. // ]);
  80. $curl = curl_init();
  81. curl_setopt($curl, CURLOPT_URL, $url);
  82. curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Accept: application/json","appKey: " . $key));
  83. curl_setopt($curl, CURLOPT_TIMEOUT, 60);
  84. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  85. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  86. curl_setopt($curl, CURLOPT_POST, 1);
  87. curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
  88. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  89. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  90. $result = curl_exec($curl);
  91. //$info = curl_getinfo($curl, CURLINFO_HEADER_OUT);
  92. //$result = json_decode($result,true);
  93. echo "<pre>";var_dump($jsonEncoded); echo "</pre>";
  94. curl_close($curl);
  95. function milliseconds()
  96. {
  97. $mt = explode(' ', microtime());
  98. return ((int)$mt[1]) * 1000 + ((int)round($mt[0] * 1000));
  99. }
  100. echo "<pre>";var_dump($result); echo "</pre>";
  101. ?>