source: branches/comu-ver2/html/test/naka/send.php @ 18701

Revision 18701, 1.7 KB checked in by nanasess, 14 years ago (diff)

Copyright の更新(#601)

  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2
3require_once("../../require.php");
4require_once(DATA_PATH . "module/Request.php");
5
6$order_url = "https://beta.epsilon.jp/cgi-bin/order/receive_order3.cgi";
7
8$arrData = array(
9    'order_number' => '93963928111111111113',
10    'st_code' => '00100-0000-00000',
11    'memo1' => '試験用オーダー情報',
12    'user_mail_add' => 'naka@lockon.co.jp',
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
27$req = new HTTP_Request($order_url);
28$req->setMethod(HTTP_REQUEST_METHOD_POST);
29       
30$arrSendData = array();
31$req->addPostDataArray($arrData);
32
33if (!PEAR::isError($req->sendRequest())) {
34    $response = $req->getResponseBody();
35} else {
36    $response = "";
37}
38$req->clearPostData();
39
40$parser = xml_parser_create();
41xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
42xml_parse_into_struct($parser,$response,$arrVal,$idx);
43xml_parser_free($parser);
44
45$err_code = lfGetXMLValue($arrVal,'RESULT','ERR_CODE');
46
47if($err_code != "") {
48    $err_detail = lfGetXMLValue($arrVal,'RESULT','ERR_DETAIL');
49    print($err_detail);
50} else {
51    $url = lfGetXMLValue($arrVal,'RESULT','REDIRECT');
52   
53    sfprintr($arrVal);
54    //header("Location: " . $url); 
55}
56
57
58function lfGetXMLValue($arrVal, $tag, $att) {
59    $ret = "";
60    foreach($arrVal as $array) {
61        if($tag == $array['tag']) {
62            if(!is_array($array['attributes'])) {
63                continue;
64            }
65            foreach($array['attributes'] as $key => $val) {
66                if($key == $att) {
67                    $ret = $val;
68                    break;
69                }
70            }           
71        }
72    }
73    $dec = urldecode($ret);
74    $enc = mb_convert_encoding($dec, 'EUC-JP', 'auto');
75    return $enc;
76}
77
78?>
Note: See TracBrowser for help on using the repository browser.