<?php
//伺服器二次驗證**
function
getreceiptdata(
$receipt
, $issandbox
= false)
else
$postdata
= json_encode(
array
('receipt-data'
=>
$receipt
)
);
$ch= curl_init(
$endpoint
);
curl_setopt($ch
, curlopt_returntransfer, true);
curl_setopt($ch
, curlopt_post, true);
curl_setopt($ch
, curlopt_postfields,
$postdata
);
curl_setopt ($ch
, curlopt_ssl_verifypeer, 0);
//這兩行一定要加,不加會報ssl 錯誤
curl_setopt ($ch
, curlopt_ssl_verifyhost, 0);
$response
= curl_exec(
$ch);
$errno
= curl_errno(
$ch);
$errmsg
= curl_error(
$ch);
curl_close($ch
);
//判斷時候出錯,丟擲異常if(
$errno
!= 0)
$data
= json_decode(
$response
);
//判斷返回的資料是否是物件
if(!
is_object
($data
))
//判斷購買時候成功
if(!isset(
$data
->status) ||
$data
->status != 0)
//返回產品的資訊
return
array
(
'quantity'
=>
$data
->receipt->quantity,
'product_id'
=>
$data
->receipt->product_id,
'transaction_id'
=>
$data
->receipt->transaction_id,
'purchase_date'
=>
$data
->receipt->purchase_date,
=>
$data
'bid'
=>
$data
->receipt->bid,
'bvrs'
=>
$data
->receipt->bvrs
);
}
$receipt
= $_get
['data'
];
$issandbox
= true;
//開始執行驗證
try
} //捕獲異常
catch(exception $e
)
?>
socket伺服器端
伺服器 include winsock2.h include string.h include stdio.h include time.h include stdarg.h include stdlib.h pragma comment lib,ws2 32 void errexit const ...
kerberos伺服器端
1.安裝tcl wget tar zvxf tcl8.5.12 src.tar.gz cd tcl8.5.12 cd unix configure make make install 3.解壓 tar xvf krb5 1.10.3 signed.tar tar zvxf krb5 1.10.3.t...
C tcp伺服器端
伺服器端 include stdafx.h include winsock2.h pragma comment lib,ws2 32.lib include using namespace std int tmain int argc,char ar 建立套接字 sserver socket af ...