source: temp/trunk/html/test/naka/send.php @ 7723

Revision 7723, 1.7 KB checked in by kakinaka, 20 years ago (diff)

blank

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2
3require_once("../../require.php");
4require_once(DATA_PATH . "module/Request.php");
5
6$order_url = "http://beta.epsilon.jp/cgi-bin/order/receive_order3.cgi";
7
8$arrData = array(
9    'order_number' => '939639281111111111',
10    'st_code' => '10100-0000-00000',
11    'memo1' => '»î¸³ÍÑ¥ª¡¼¥À¡¼¾ðÊó',
12    'user_mail_add' => '[email protected]',
13    'item_name' => '¥×¥ê¥ó¥¿',
14    'contract_code' => '13094800',
15    'user_name' => 'naka',
16    'process_code' => '1',
17    'mission_code' => '1',
18    'item_price' => '34800',
19    'xml' => '1',       
20    'item_code' => 'abc12345',
21    'memo2' => '',
22    'user_id' => 'ktest'
23    ,'conveni_code' = "11"
24);
25
26$req = new HTTP_Request($order_url);
27$req->setMethod(HTTP_REQUEST_METHOD_POST);
28       
29$arrSendData = array();
30$req->addPostDataArray($arrData);
31
32if (!PEAR::isError($req->sendRequest())) {
33    $response = $req->getResponseBody();
34} else {
35    $response = "";
36}
37$req->clearPostData();
38
39$parser = xml_parser_create();
40xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
41xml_parse_into_struct($parser,$response,$arrVal,$idx);
42xml_parser_free($parser);
43
44$err_code = lfGetXMLValue($arrVal,'RESULT','ERR_CODE');
45
46if($err_code != "") {
47    $err_detail = lfGetXMLValue($arrVal,'RESULT','ERR_DETAIL');
48    print($err_detail);
49} else {
50    $url = lfGetXMLValue($arrVal,'RESULT','REDIRECT');
51    header("Location: " . $url);   
52}
53
54
55function lfGetXMLValue($arrVal, $tag, $att) {
56    $ret = "";
57    foreach($arrVal as $array) {
58        if($tag == $array['tag']) {
59            if(!is_array($array['attributes'])) {
60                continue;
61            }
62            foreach($array['attributes'] as $key => $val) {
63                if($key == $att) {
64                    $ret = $val;
65                    break;
66                }
67            }           
68        }
69    }
70    $dec = urldecode($ret);
71    $enc = mb_convert_encoding($dec, 'EUC-JP', 'auto');
72    return $enc;
73}
74
75?>
Note: See TracBrowser for help on using the repository browser.