verifyToken.php
1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
//GPL license
include sanitize_file_name('gplLicense.php');
/*to verify the signature token*/
function Beagle_WP_verify_Token()
{
global $wpdb;
global $apiServerBaseUrl;
$Beagle_WP_scan_table = $wpdb->prefix . "beagleScanData";
$getTokenFromTbl = $wpdb->get_results($wpdb->prepare("SELECT * FROM $Beagle_WP_scan_table"));
foreach ($getTokenFromTbl as $print) {
$Beagle_WP_access_token = $print->access_token;
$Beagle_WP_application_token = $print->application_token;
}
$beagleVerifyURL = $apiServerBaseUrl . 'test/signature/verify';
$verifySignature = array("access_token" => $Beagle_WP_access_token, "application_token" => $Beagle_WP_application_token, "type" => "WORDPRESS");
$verifyResponse = wp_remote_post($beagleVerifyURL, array(
'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
'body' => json_encode($verifySignature),
'method' => 'POST',
'data_format' => 'body',
));
$statusResponse = json_decode(wp_remote_retrieve_body($verifyResponse));
try {
echo json_encode($statusResponse);
exit;
} catch (Exception $e) {
}
}