You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.6 KiB
55 lines
1.6 KiB
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
|
<?php
|
|
$now = gmdate("YmdHis");
|
|
$data = 'M0000.' . $now;
|
|
$sign = hash_hmac('SHA256', $data, '964C834F7BF2BB70', false);
|
|
|
|
?>
|
|
|
|
<script>
|
|
// var api_key = '964C834F7BF2BB70';
|
|
// var validation = "";
|
|
// var apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
|
|
// headerParam = {
|
|
// UserId: 'M0000',
|
|
// Pwd: 'M012290493119',
|
|
// TimestampUTC: <?= $now ?>,
|
|
// Sign: '<?= $sign ?>'
|
|
// };
|
|
|
|
// obj = {
|
|
// type: 'get',
|
|
// url: `${apiurl}`,
|
|
// dataType: 'json',
|
|
// headers: headerParam,
|
|
// crossDomain: true,
|
|
// success: function(res) {
|
|
// validation = res.Data['CHI_Authorization'];
|
|
// },
|
|
// error: function(err){
|
|
// console.log(err);
|
|
// }
|
|
// };
|
|
// jQuery.ajax(obj);
|
|
fetch('http://60.244.87.101:880//twWebAPI/GetAuth', {
|
|
method: 'GET',
|
|
headers: {
|
|
'Origin': 'https://www.masada.com.tw',
|
|
'Access-Control-Request-Method': 'GET',
|
|
'Access-Control-Request-Headers': 'X-Requested-With, Content-Type'
|
|
}
|
|
})
|
|
.then(function(response) {
|
|
if (response.ok) {
|
|
return response.json();
|
|
} else {
|
|
throw new Error('網絡錯誤');
|
|
}
|
|
})
|
|
.then(function(data) {
|
|
// 處理成功的回應
|
|
})
|
|
.catch(function(error) {
|
|
// 處理錯誤
|
|
});
|
|
</script>
|