Example API V1.1 - 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 Example API V1.1.php
- <?php
- $api_key = '52172CF0F25851F62F089B763CBA6B12901FF90A';
- $secret_key = '9AF0EEE8642E9CFD4978D684628DE340C3D9E82A';
- //Check TransportFee
- $parameters = array(
- 'api_key' => $api_key,
- 'timestamp' => time(),
- 'data' => array(
- 'pickup_address_code' => 'VN034018001',
- 'receive_address_code' => 'VN034018002',
- 'service' => 'EE1',
- 'cod_value' => 50000,
- 'weight' =>1
- )
- );
- //Create Authorization code
- $authorization = hash_hmac('sha1','SPEEDLINK', json_encode($parameters).$secret_key);
- echo 'CheckFee: <br>';
- echo 'Authorization: '.$authorization.'</br>';
- echo 'Parameter: </br>';
- echo json_encode($parameters);
- echo '<hr><br>';
- // Create Order
- $parameters = array(
- 'timestamp' => time(),
- 'api_key' => $api_key,
- 'data' => array(
- 'order_no' => 'ICTTEST124',
- 'order_note' => '',
- 'pickup_address' => '25 Ngô Quyền, Phường 6, Quận 10, TP.Hồ Chí Minh',
- 'pickup_address_code' => 'VN039007006',
- 'shipper_name' => 'Unica.vn',
- 'shipper_phone' => '0932776665',
- 'receiver_address' => '66/20 Hùng Vương, Phường 1, Quận 10, Thành phố Hồ Chí Minh',
- 'receiver_address_code' => 'VN034018009',
- 'receiver_name' => 'Võ Tấn Lực',
- 'receiver_phone' => '0905833933',
- 'weight' => 5,
- 'service_code' => 'TC1',
- 'payment_method' => 1,
- 'payer' => 1,
- 'cash' => 349000,
- 'cod_value' => 349000
- )
- );
- //Create Authorization code
- $authorization = hash_hmac('sha1','SPEEDLINK', json_encode($parameters).$secret_key);
- echo 'Create Order: <br>';
- echo 'Authorization: '.$authorization.'</br>';
- echo 'Parameter: </br>';
- echo json_encode($parameters);
- echo '<hr><br>';
- // Tracking
- $parameters = array(
- 'timestamp' => time(),
- 'api_key' => $api_key,
- 'order_no' => 'ICTTEST124'
- );
- //Create Authorization code
- $authorization = hash_hmac('sha1','SPEEDLINK', json_encode($parameters).$secret_key);
- echo 'Tracking: <br>';
- echo 'Authorization: '.$authorization.'</br>';
- echo 'Parameter: </br>';
- echo json_encode($parameters);
- echo '<hr><br>';
- ///Cancel Order
- $parameters = array(
- 'timestamp' => time(),
- 'api_key' => $api_key,
- 'order_no' => 'ICTTEST124'
- );
- //Create Authorization code
- $authorization = hash_hmac('sha1','SPEEDLINK', json_encode($parameters).$secret_key);
- echo 'Cancel: <br>';
- echo 'Authorization: '.$authorization.'</br>';
- echo 'Parameter: </br>';
- echo json_encode($parameters);
File Description
- Example API V1.1
- PHP Code
- 19 Aug-2019
- 2.44 Kb
You can Share it:
Latest PHP Pastes