api_sendt.php 1.2 KB

1234567891011121314151617181920212223242526272829
  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. $jsonEncoded = '
  6. {"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{ "from":"0xD81eeE6b39d9556c3067A3551A3FB2882b92F327", "to":"0x119b58faddcdbc09cafcd272530aa079cec10004", "gas":"0x31b2ef", "data":"0x11111111"}], "id":1}
  7. ';
  8. //$jsonEncoded = json_encode(['dateTime' => , 'kind'=> 3, 'diagnosticCard' => '123e4567-e89b-12d3-a456-426655440000', 'subnumber' => '23456787', 'number'=> '34', 'series'=> '2']);
  9. $curl = curl_init();
  10. curl_setopt($curl, CURLOPT_URL, $url);
  11. curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Accept: application/json","appKey: " . $key));
  12. curl_setopt($curl, CURLOPT_TIMEOUT, 20);
  13. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  14. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  15. curl_setopt($curl, CURLOPT_POST, 1);
  16. curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonEncoded);
  17. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  18. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  19. $result = curl_exec($curl);
  20. echo $result;
  21. curl_close($curl);
  22. ?>