source: branches/feature-module-zeus/html/test/naka/shopcgi.php @ 8

Revision 8, 2.5 KB checked in by root, 17 years ago (diff)

new import

Line 
1<?php
2
3require_once("../../require.php");
4require_once(DATA_PATH . "module/Request.php");
5
6$entry_url = "http://mod-i.ccsware.net/ohayou/EntryTran.php";
7$exec_url = "https://mod-i.ccsware.net/ohayou/ExecTran.php";
8// ¼õÃíÈÖ¹æ¤Î¼èÆÀ
9$order_id = sfGetUniqRandomId();
10
11// ŹÊÞ¾ðÊó¤ÎÁ÷¿®
12$arrData = array(
13    'OrderId' => $order_id,     // ŹÊÞ¤´¤È¤Ë°ì°Õ¤ÊÃíʸID¤òÁ÷¿®¤¹¤ë¡£
14    'TdTenantName' => '',       // 3Dǧ¾Ú»þɽ¼¨ÍÑŹÊÞ̾
15    'TdFlag' => '',             // 3D¥Õ¥é¥°
16    'ShopId' => 'test000003087',// ¥·¥ç¥Ã¥×ID
17    'ShopPass' => 'lockon',     // ¥·¥ç¥Ã¥×¥Ñ¥¹¥ï¡¼¥É
18    'Currency' => 'JPN',        // Ä̲ߥ³¡¼¥É
19    'Amount' => '1000',         // ¶â³Û
20    'Tax' => '50',              // ¾ÃÈñÀÇ
21    'JobCd' => 'CHECK',         // ½èÍý¶èʬ
22    'TenantNo' => '111111111',  // cgi-4¤ÇºîÀ®¤·¤¿Å¹ÊÞID¤òÁ÷¿®¤¹¤ë¡£
23);
24
25$req = new HTTP_Request($entry_url);
26$req->setMethod(HTTP_REQUEST_METHOD_POST);
27       
28$req->addPostDataArray($arrData);
29
30if (!PEAR::isError($req->sendRequest())) {
31    $response = $req->getResponseBody();
32} else {
33    $response = "";
34}
35$req->clearPostData();
36$arrRet = lfGetPostArray($response);
37
38sfPrintR($arrRet);
39
40// ·èºÑ¾ðÊó¤ÎÁ÷¿®
41$arrData = array(
42    'AccessId' => $arrRet['ACCESS_ID'],
43    'AccessPass' => $arrRet['ACCESS_PASS'],
44    'OrderId' => $order_id,
45    'RetURL' => 'http://test.ec-cube.net/ec-cube/test/naka/recv.php',
46    // ¥×¥í¥Ñ¡¼¥«¡¼¥É¤ò°·¤ï¤Ê¤¤¾ì¹ç¤ÏVISA¸ÇÄê¤ÇOK
47    'CardType' => 'VISA, 11111, 111111111111111111111111111111111111, 1111111111',
48    // »Ùʧ¤¤ÊýË¡
49    /*
50        1:°ì³ç
51        2:ʬ³ä
52        3:¥Ü¡¼¥Ê¥¹°ì³ç
53        4:¥Ü¡¼¥Ê¥¹Ê¬³ä
54        5:¥ê¥Üʧ¤¤
55     */
56    'Method' => '2',
57    // »Ùʧ²ó¿ô
58    'PayTimes' => '4',
59    'CardNo1' => '4444',
60    'CardNo2' => '4444',
61    'CardNo3' => '4444',
62    'CardNo4' => '5780',
63    'ExpireMM' => '06',
64    'ExpireYY' => '07',
65    // ²ÃÌÁŹ¼«Í³¹àÌÜÊֵѥե饰
66    'ClientFieldFlag' => '1',
67    'ClientField1' => 'f1',
68    'ClientField2' => 'f2',
69    'ClientField3' => 'f3',
70    // ¥ê¥À¥¤¥ì¥¯¥È¥Ú¡¼¥¸¤Ç¤Î±þÅú¤ò¼õ¤±¼è¤é¤Ê¤¤
71    'ModiFlag' => '1', 
72);
73
74$req = new HTTP_Request($exec_url);
75$req->setMethod(HTTP_REQUEST_METHOD_POST);
76
77$req->addPostDataArray($arrData);
78
79if (!PEAR::isError($req->sendRequest())) {
80    $response = $req->getResponseBody();
81} else {
82    $response = "";
83}
84$req->clearPostData();
85
86$arrRet = lfGetPostArray($response);
87
88sfPrintR($arrRet);
89
90//---------------------------------------------------------------------------------------------------------------------------------
91function lfGetPostArray($text) {
92    if($text != "") {
93        $text = ereg_replace("[\n\r]", "", $text);
94        $arrTemp = split("&", $text);
95        foreach($arrTemp as $ret) {
96            list($key, $val) = split("=", $ret);
97            $arrRet[$key] = $val;
98        }
99    }
100    return $arrRet;
101}
102?>
Note: See TracBrowser for help on using the repository browser.