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.
Result of php executing
Full code of signserver.php
- <?php
- function getIndodaxServerTime() {
- $indodaxTimeURL = 'https://indodax.com/tapi/server_time';
- $response = json_decode(file_get_contents($indodaxTimeURL), true);
- return $response['serverTime'];
- }
- $secretKey = 'e3db818579e56cd32731695af0f1173a138b16b0a7a1ab3886ea05284ed4324b4454a6c332409890';
- $indodaxServerTime = getIndodaxServerTime();
- $localTimestamp = round(microtime(true) * 1000);
- $timeDifference = $indodaxServerTime - $localTimestamp;
- $adjustedTimestamp = $localTimestamp + $timeDifference;
- $recvWindow = $adjustedTimestamp - 5000;
- $payload = [
- 'method' => 'deposit-option'
- ];
- $payload['timestamp'] = $adjustedTimestamp;
- $payload['recvWindow'] = $recvWindow;
- $payloadString = json_encode($payload);
- $signature = hash_hmac('sha512', $payloadString, $secretKey);
- $payload['signature'] = $signature;
- echo json_encode($payload, JSON_PRETTY_PRINT);
- ?>