api_etc2.php 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. //$key = '6a7bdbaa-6bc1-4159-a2f4-07a13c8907d1';
  3. //$url = '62.141.88.61:8085/Thingworx/Things/connSmoppLibrary/Services/get_employee_status';
  4. $url = "http://127.0.0.1:8545";
  5. //0xa87d942c9d2541a6b500dde7ac433dcb6b805640345fd60ed7d8a2d9df2dc58b
  6. $jsonEncoded = '
  7. {"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0x119b58faddcdbc09cafcd272530aa079cec10004_", "data":"0x696e6372"},"latest"],"id":2}
  8. ';
  9. //$jsonEncoded = json_encode(['dateTime' => , 'kind'=> 3, 'diagnosticCard' => '123e4567-e89b-12d3-a456-426655440000', 'subnumber' => '23456787', 'number'=> '34', 'series'=> '2']);
  10. $curl = curl_init();
  11. curl_setopt($curl, CURLOPT_URL, $url);
  12. curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Accept: application/json","appKey: " . $key));
  13. curl_setopt($curl, CURLOPT_TIMEOUT, 20);
  14. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  15. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  16. curl_setopt($curl, CURLOPT_POST, 1);
  17. curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
  18. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  19. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  20. $result = curl_exec($curl);
  21. echo $result;
  22. curl_close($curl);
  23. ?>