1.在綠界官網下載php的擋找sample_CvsMap.php與Ecpay.Logistic.Integration.php
2.另外寫一個要地圖POST的擋Map_data.php
3.http://localhost:8888 只是網址中要找出POST的擋
4.'MerchantID' => '2000132'只是測試的擋,如要正式的在綠界申請會員在系統介接設定取出商店代號
sample_CvsMap.php
<?php
// 電子地圖
define('HOME_URL', 'http://localhost:8888');
require('Ecpay.Logistic.Integration.php');
try {
$AL = new EcpayLogistics();
$AL->Send = array(
'MerchantID' => '2000132',
'MerchantTradeNo' => 'no' . date('YmdHis'),
'LogisticsSubType' => EcpayLogisticsSubType::UNIMART,
'IsCollection' => EcpayIsCollection::NO,
'ServerReplyURL' => HOME_URL . '/練習/Map_data.php',
'ExtraData' => '測試額外資訊',
'Device' => EcpayDevice::PC
);
// CvsMap(Button名稱, Form target)
$html = $AL->CvsMap('電子地圖(統一)');
echo $html;
} catch(Exception $e) {
echo $e->getMessage();
}
?>
Map_data.php
<?php
echo $_POST['CVSAddress'].'<br>';
echo $_POST['CVSStoreName'].'<br>';
echo $_POST['CVSStoreID'].'<br>';
?>