1、Signature method
The general steps for signature generation are as follows:
In the first step, set all the sent or received data as set M. Sort M by ASCII code of the parameter name from smallest to largest (dictionary order), remove the space on both sides of the parameter value ,using the format of the URL key-value pairs (i.e. key1=value1&key2=value2...) to splice the string stringA.
Pay particular attention to the following important rules.
◆ ASCII codes of parameter names are sorted from small to large (dictionary order).
◆Parameter names are case-sensitive.
◆Parameter value needs URL_ Encode code
◆The interface may add fields, which must be supported when verifying the signatures.
The second step is to splice the key on the end of stringA to get stringSignTemp and perform MD5 operation on stringSignTemp, then convert all the characters of the obtained string to uppercase to get gntoken value.
◆ APPKEY Setting Path: Platform-->User Center-->Reseller-->API Settings
2、Generate signature string
Assume that the transmitted parameters are as follows, take PHP code as an example:
$params = array ( 'appid' => 'APPID', 'gntime' => 1234567890, 'ym' => 'gname.com', 'url' => 'https://www.gname.com', )
Step 1: The value needs to be url_encode encoded,according to the format of key=value for the parameters, and the parameter names are sorted in ASCII dictionary order as follows:
$stringA = "appid=APPID&gntime=1234567890&url=https%3A%2F%2Fwww.gname.com&ym=gname.com";
Step 2: Splice APPKEY:
$appkey = "APPKEY" // Note: appkey
$stringB = "appid=APPID&gntime=1234567890&url=https%3A%2F%2Fwww.gname.com&ym=gname.comAPPKEY"; //note: MD5 signature method and convert to uppercase $gntoken = strtoupper(md5($stringB)); //B48D34C9A15A3F33ED61396E5BD8F1F8
Current system time:2024-12-21 22:30:42(UTC+8) Privacy PolicyRegistrants' Benefits And Responsibilities SpecificationRegistrant Educational Information
Copyright© 2024 GNAME.COM. All rights reserved.