| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | require_once("../../require.php"); |
|---|
| 4 | require_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' => '', |
|---|
| 15 | 'TdFlag' => '', |
|---|
| 16 | 'ShopId' => 'test', |
|---|
| 17 | 'Amount' => '1000', |
|---|
| 18 | 'ShopPass' => 'test', |
|---|
| 19 | 'Currency' => 'JPN', |
|---|
| 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 | |
|---|
| 30 | if (!PEAR::isError($req->sendRequest())) { |
|---|
| 31 | $response = $req->getResponseBody(); |
|---|
| 32 | } else { |
|---|
| 33 | $response = ""; |
|---|
| 34 | } |
|---|
| 35 | $req->clearPostData(); |
|---|
| 36 | $arrRet = lfGetPostArray($response); |
|---|
| 37 | |
|---|
| 38 | // ·èºÑ¾ðÊó¤ÎÁ÷¿® |
|---|
| 39 | $arrData = array( |
|---|
| 40 | 'AccessId' => $arrRet['ACCESS_ID'], |
|---|
| 41 | 'AccessPass' => $arrRet['ACCESS_PASS'], |
|---|
| 42 | 'OrderId' => $order_id, |
|---|
| 43 | 'RetURL' => 'http://test.ec-cube.net/ec-cube/test/naka/recv.php', |
|---|
| 44 | // ¥×¥í¥Ñ¡¼¥«¡¼¥É¤ò°·¤ï¤Ê¤¤¾ì¹ç¤ÏVISA¸ÇÄê¤ÇOK |
|---|
| 45 | 'CardType' => 'VISA, 11111, 111111111111111111111111111111111111, 1111111111', |
|---|
| 46 | 'Method' => '2', |
|---|
| 47 | 'PayTimes' => '4', |
|---|
| 48 | 'CardNo1' => '4444', |
|---|
| 49 | 'CardNo2' => '4444', |
|---|
| 50 | 'CardNo3' => '4444', |
|---|
| 51 | 'CardNo4' => '5780', |
|---|
| 52 | 'ExpireMM' => '06', |
|---|
| 53 | 'ExpireYY' => '07', |
|---|
| 54 | 'ClientFieldFlag' => '1', |
|---|
| 55 | 'ClientField1' => 'f1', |
|---|
| 56 | 'ClientField2' => 'f2', |
|---|
| 57 | 'ClientField3' => 'f3', |
|---|
| 58 | 'ModiFlag' => '1', // ¥ê¥À¥¤¥ì¥¯¥È¥Ú¡¼¥¸¤Ç¤Î±þÅú¤ò¼õ¤±¼è¤é¤Ê¤¤¡£ |
|---|
| 59 | ); |
|---|
| 60 | |
|---|
| 61 | $req = new HTTP_Request($exec_url); |
|---|
| 62 | $req->setMethod(HTTP_REQUEST_METHOD_POST); |
|---|
| 63 | |
|---|
| 64 | $req->addPostDataArray($arrData); |
|---|
| 65 | |
|---|
| 66 | if (!PEAR::isError($req->sendRequest())) { |
|---|
| 67 | $response = $req->getResponseBody(); |
|---|
| 68 | } else { |
|---|
| 69 | $response = ""; |
|---|
| 70 | } |
|---|
| 71 | $req->clearPostData(); |
|---|
| 72 | |
|---|
| 73 | $arrRet = lfGetPostArray($response); |
|---|
| 74 | |
|---|
| 75 | sfPrintR($arrRet); |
|---|
| 76 | |
|---|
| 77 | //--------------------------------------------------------------------------------------------------------------------------------- |
|---|
| 78 | function lfGetPostArray($text) { |
|---|
| 79 | if($text != "") { |
|---|
| 80 | $text = ereg_replace("[\n\r]", "", $text); |
|---|
| 81 | $arrTemp = split("&", $text); |
|---|
| 82 | foreach($arrTemp as $ret) { |
|---|
| 83 | list($key, $val) = split("=", $ret); |
|---|
| 84 | $arrRet[$key] = $val; |
|---|
| 85 | } |
|---|
| 86 | } |
|---|
| 87 | return $arrRet; |
|---|
| 88 | } |
|---|
| 89 | ?> |
|---|