123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <input type="text" name="series">
- <input type="text" name="number">
- <input type="text" name="subnumber">
- <input type="text" name="diagnosticMap">
- <input type="text" name="sectionId">
- <input type="text" name="kind" value="ТР-1">
- <?php
- $series = $_REQUEST["series"];
- $number = $_REQUEST["number"];
- $subnumber = $_REQUEST["subnumber"];
- $series = $_REQUEST["diagnosticMap"];
- $series = $_REQUEST["sectionId"];
- $kind = $_REQUEST["kind"];
- $url = $_SERVER['SERVER_NAME'].'/api/service/addwork';
- //$url = $_SERVER['SERVER_NAME'].'/api/service/checkrfid';
- $key = '07a13c8907d1-6a7bdba1-a2fz-aatgu4j';
- //{"PlaceOfRepair":"bbdac35c-629f-11e1-930e-001517e6ca10",
- //"TypeOfRepair":"ТР-1",
- //"HomeDepot":"fc73e6a5-6a02-11e2-9410-ac162db0b20c",
- //"SectionNumber":"0026Б",
- //"DiagnosticMapslocomotive":"3313f3d0-5f6b-11e9-80d0-005056011052",
- //"LocomotiveNumber":"ЧС7",
- //"RepairStartDatePlan":"2019-04-19T07:00:00",
- //"Section":"2e7ba168-f04a-11e1-8e8b-001517e6ca10",
- //"SectionSubnumber":"12020517",
- //"LocomotiveSeries":"8c5d1a77-4649-11e1-b72e-001517e6ca10",
- //"RepairStartDateFact":"0001-01-01T00:00:00"}
- $jsonEncoded = json_encode(
- [
- "series" => "ЧС7",
- "number"=>"0026Б",
- "subnumber"=>"12020517",
- "diagnosticCard"=>"3313f3d0-5f6b-11e9-80d0-005056011052",
- "rfid"=>"2545856584",
- "kind"=>"ТР-1",
- "dateTime" => "1562077752",
- "sectionId"=>"2e7ba168-f04a-11e1-8e8b-001517e6ca10",
- ]);
- //{"PlaceOfRepair":"bbdac35c-629f-11e1-930e-001517e6ca10",
- // "TypeOfRepair":"ТР-1",
- // "HomeDepot":"fc73e6a5-6a02-11e2-9410-ac162db0b20c",
- // "SectionNumber":"0026Б",
- // "DiagnosticMapslocomotive":"3313f3d0-5f6b-11e9-80d0-005056011052",
- // "LocomotiveNumber":"ЧС7",
- // "RepairStartDatePlan":"2019-04-19T07:00:00",
- // "Section":"2e7ba168-f04a-11e1-8e8b-001517e6ca10",
- // "SectionSubnumber":"12020517",
- // "LocomotiveSeries":"8c5d1a77-4649-11e1-b72e-001517e6ca10",
- // "RepairStartDateFact":"0001-01-01T00:00:00"}
- //
- //{"PlaceOfRepair":"bbdac35c-629f-11e1-930e-001517e6ca10","TypeOfRepair":"ТР-1","HomeDepot":"fc73e6a6-6a02-11e2-9410-ac162db0b20c",
- // "SectionNumber":"0223Б",
- // "DiagnosticMapslocomotive":"63cfbb77-9ed3-11e8-80cf-005056011052",
- // "LocomotiveNumber":"ЧС7","RepairStartDatePlan":"2018-08-16T07:00:00",
- // "Section":"34d11b7c-f04a-11e1-8e8b-001517e6ca10",
- // "SectionSubnumber":"12024469",
- // "LocomotiveSeries":"8c5d1a77-4649-11e1-b72e-001517e6ca10",
- // "RepairStartDateFact":"0001-01-01T00:00:00"}
- //
- //{"PlaceOfRepair":"bbdac35c-629f-11e1-930e-001517e6ca10",
- // "TypeOfRepair":"ТР-1","HomeDepot":"fc73e6a6-6a02-11e2-9410-ac162db0b20c",
- // "SectionNumber":"0275А",
- // "DiagnosticMapslocomotive":"befe3b99-132a-11e9-80cf-005056011052",
- // "LocomotiveNumber":"ЧС7","RepairStartDatePlan":"2019-01-11T07:00:00",
- // "Section":"3c0afed3-5c25-11e3-9702-ac162db0b20c",
- // "SectionSubnumber":"12025490",
- // "LocomotiveSeries":"8c5d1a77-4649-11e1-b72e-001517e6ca10",
- // "RepairStartDateFact":"0001-01-01T00:00:00"}
- //$jsonEncoded = json_encode(
- // [
- // "locomotive_serie" => "2ЭС5К",
- // "number"=>"0275А",
- // "subnumber"=>"12025490",
- // "diagnosticMap"=>"004d9e52-9848-11e9-80d5-005056011052",
- // "typeOfRepair"=>"ТР-1",
- // "dateTime" => "1562077752",
- // "sectionId"=>"34d11b7c-f04a-11e1-8e8b-001517e6ca10",
- // "PP-5dbc36ea-47e9-472f-ba17-b45422fc25ac"=>array()
- // ]);
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Accept: application/json","appKey: " . $key));
- curl_setopt($curl, CURLOPT_TIMEOUT, 60);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($curl, CURLOPT_POST, 1);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- $result = curl_exec($curl);
- //$info = curl_getinfo($curl, CURLINFO_HEADER_OUT);
- //$result = json_decode($result,true);
- echo "<pre>";var_dump($jsonEncoded); echo "</pre>";
- curl_close($curl);
- function milliseconds()
- {
- $mt = explode(' ', microtime());
- return ((int)$mt[1]) * 1000 + ((int)round($mt[0] * 1000));
- }
- echo "<pre>";var_dump($result); echo "</pre>";
- ?>
|