api_sha3.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. //$key = '6a7bdbaa-6bc1-4159-a2f4-07a13c8907d1';
  3. //$url = '62.141.88.61:8085/Thingworx/Things/connSmoppLibrary/Services/get_employee_status';
  4. //echo strtoupper(bin2hex(iconv('UTF-8', 'UCS-2', 'GetStatus()')));
  5. $code = "0x".bin2hex('myTransfer()');
  6. echo "code $code";
  7. //echo "0x".bin2hex('incrementCounter()');
  8. ////echo '<br>';
  9. ////echo "0x".bin2hex('getCount()');
  10. echo '<br>';
  11. $url = "http://127.0.0.1:8545";
  12. $jsonEncoded = '
  13. {"jsonrpc":"2.0","method":"web3_sha3","params":["'.$code.'"],"id":1}
  14. ';
  15. //$jsonEncoded = json_encode(['dateTime' => , 'kind'=> 3, 'diagnosticCard' => '123e4567-e89b-12d3-a456-426655440000', 'subnumber' => '23456787', 'number'=> '34', 'series'=> '2']);
  16. $curl = curl_init();
  17. curl_setopt($curl, CURLOPT_URL, $url);
  18. curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Accept: application/json","appKey: " . $key));
  19. curl_setopt($curl, CURLOPT_TIMEOUT, 20);
  20. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  21. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  22. curl_setopt($curl, CURLOPT_POST, 1);
  23. curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
  24. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  25. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  26. $result = curl_exec($curl);
  27. echo $result;
  28. curl_close($curl);
  29. ?>