123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- //$key = '6a7bdbaa-6bc1-4159-a2f4-07a13c8907d1';
- //$url = '62.141.88.61:8085/Thingworx/Things/connSmoppLibrary/Services/get_employee_status';
- /*
- "http://corp.prmsys.net/api/service/checkrfid"
- "dateTime":
- "number":
- "series":
- "rfid":
- "subnumber":
- "sectionId":
- "http://corp.prmsys.net/api/service/addwork"
- "dateTime":
- "number":
- "series":
- "diagnosticCard":
- "subnumber":
- "kind":
- "sectionId":
- */
- $url = $_SERVER['SERVER_NAME'].'/api/service/addwork';
- //$url = $_SERVER['SERVER_NAME'].'/api/service/checkrfid';
- $key = '07a13c8907d1-6a7bdba1-a2fz-aatgu4j';
- //checkrfid
- $jsonEncoded = json_encode(
- [
- "series" => "2ЭС5К",
- "number"=>"0146А",
- "subnumber"=>"11374428",
- "diagnosticCard"=>"e95386f0-9bad-11e9-80d5-005056011052",
- "rfid"=>"2545856584",
- "kind"=>"ТР-1",
- "dateTime" => "1562077752",
- "sectionId"=>"ac895a1e-f049-11e1-8e8b-001517e6ca10",
- ]);
- //код 4452578
- //$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>";
- ?>
|