如何使用Curl API Key和API Secret来检查许可证密钥

时间:2017-07-29 07:55:59

标签: php api curl

我想使用Curl和API密钥以及API密钥检查许可证密钥

这是返回值

成功处理后,License Manager将返回纯文本

消息将包含两行或三行,类似于以下内容:

成功许可证密钥WPLICMxx4bc2xxx1e471 要么 错误密钥无效

示例PHP代码   下面是一个示例PHP代码,展示了如何通过创建许可证     API

/*** Mandatory data ***/ 
// Post URL 
$postURL = ""; 
// The Secret key 
$secretKey = "597c038865e788.30430360"; 

/*** Optional Data ***/ 
$firstname = "John"; 
$lastname = "Doe"; 
$email = "john.doe@gmail.com"; 

// prepare the data 
$data = array (); 
$data['secret_key'] = $secretKey; 
$data['slm_action'] = 'slm_create_new'; 
$data['first_name'] = $firstname; 
$data['last_name'] = $lastname; 
$data['email'] = $email; 

// send data to post URL 
$ch = curl_init ($postURL); 
curl_setopt ($ch, CURLOPT_POST, true); 
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); 
$returnValue = curl_exec ($ch); 

// Process the return values 
//var_dump($returnValue);

我想使用Curl和API密钥以及API密钥检查许可证密钥

1 个答案:

答案 0 :(得分:0)

您需要使用已定义的密钥设置HTTPHEADER,例如

curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'user: UserName', 'pass: blahPasswordHere' ));

userpass需要更改为接收服务器正在查找的内容

相关问题