Example API V1 - 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 Example API V1.php

  1. <?php
  2. $api_key = '52172CF0F25851F62F089B763CBA6B12901FF90A';
  3. $secret_key = '9AF0EEE8642E9CFD4978D684628DE340C3D9E82A';
  4. // Create Order
  5. $parameters = array(
  6.     'timestamp' => time(),
  7.     'api_key' => $api_key,
  8.     'data' => array(
  9.         'order_no' => 'ICTTEST124',
  10.         'order_note' => '',
  11.         'pickup_address' => '25 Ngô Quyền, Phường 6, Quận 10, TP.Hồ Chí Minh',
  12.         'pickup_address_code' => 'VN039007006',
  13.         'shipper_name' => 'Unica.vn',
  14.         'shipper_phone' => '0932776665',
  15.         'receiver_address' => '66/20 Hùng Vương, Phường 1, Quận 10, Thành phố Hồ Chí Minh',
  16.         'receiver_address_code' => 'VN034018009',
  17.         'receiver_name' => 'Võ Tấn Lực',
  18.         'receiver_phone' => '0905833933',
  19.         'weight' => 5,
  20.         'service_code' => 'TC1',
  21.         'payment_method' => 1,
  22.         'payer' => 1,
  23.         'cash' => 349000,
  24.         'cod_value' => 349000
  25.     )
  26. );
  27. //Create Authorization code
  28. $authorization = hash_hmac('sha1','SPEEDLINK', json_encode($parameters).$secret_key);
  29. echo 'Authorization: '.$authorization.'</br>';
  30. echo 'Parameter: </br>';
  31. echo json_encode($parameters);
  32. echo '<hr><br>';
  33. // Tracking
  34. $parameters = array(
  35.     'timestamp' => time(),
  36.     'api_key' => $api_key,
  37.     'order_no' => 'ICTTEST124'
  38. );
  39. //Create Authorization code
  40. $authorization = hash_hmac('sha1','SPEEDLINK', json_encode($parameters).$secret_key);
  41. echo 'Authorization: '.$authorization.'</br>';
  42. echo 'Parameter: </br>';
  43. echo json_encode($parameters);
  44.  
  45.  
File Description
  • Example API V1
  • PHP Code
  • 15 Aug-2019
  • 1.47 Kb
You can Share it: