api_getb.php 1.7 KB

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