signserver - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of signserver.php

  1. <?php
  2.  
  3. function getIndodaxServerTime() {
  4.     $indodaxTimeURL = 'https://indodax.com/tapi/server_time';
  5.     $response = json_decode(file_get_contents($indodaxTimeURL), true);
  6.     return $response['serverTime'];
  7. }
  8.  
  9. $secretKey = 'e3db818579e56cd32731695af0f1173a138b16b0a7a1ab3886ea05284ed4324b4454a6c332409890';
  10.  
  11. $indodaxServerTime = getIndodaxServerTime();
  12. $localTimestamp = round(microtime(true) * 1000);
  13. $timeDifference = $indodaxServerTime - $localTimestamp;
  14. $adjustedTimestamp = $localTimestamp + $timeDifference;
  15. $recvWindow = $adjustedTimestamp - 5000;
  16.  
  17. $payload = [
  18.     'method' => 'deposit-option'
  19.     ];
  20. $payload['timestamp'] = $adjustedTimestamp;
  21. $payload['recvWindow'] = $recvWindow;
  22.  
  23. $payloadString = json_encode($payload);
  24. $signature = hash_hmac('sha512', $payloadString, $secretKey);
  25. $payload['signature'] = $signature;
  26.  
  27. echo json_encode($payload, JSON_PRETTY_PRINT);
  28.  
  29. ?>
  30.  
  31.  
  32.  
File Description
  • signserver
  • PHP Code
  • 02 Feb-2024
  • 887 Bytes
You can Share it: