Changeset 21864 for branches/version-2_12-dev/test/api_test.php
- Timestamp:
- 2012/05/30 14:32:19 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/test/api_test.php
r21722 r21864 3 3 * APIの動作確認・検証用プログラム 4 4 * 5 * Copyright(c) 2000-201 1LOCKON CO.,LTD. All Rights Reserved.5 * Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved. 6 6 * 7 7 * http://www.lockon.co.jp/ … … 104 104 <body> 105 105 EC-CUBE API TEST<br /> 106 ※このプログラムにはセキュリティ考慮が一切されていませんので取り扱いには注意をして下さい。 107 <hr /> 108 <form action="?" method="POST" id="form"> 109 <input type="hidden" name="mode" id="mode" value="" /> 110 EndPoint:<input type="text" name="EndPoint" style="width:400px;" value="<?php echo htmlspecialchars($_REQUEST['EndPoint']); ?>" /><select name="type"> 111 <option value="json.php" <?php if($type =='json.php'){ echo 'selected';} ?>>json.php</option> 112 <option value="xml.php" <?php if($type =='xml.php'){ echo 'selected';} ?>>xml.php</option> 113 <option value="php.php" <?php if($type =='php.php'){ echo 'selected';} ?>>php.php</option> 114 <option value="index.php" <?php if($type =='index.php'){ echo 'selected';} ?>>index.php</option> 115 </select><br /> 116 Service:<input type="text" name="Service" value="<?php echo htmlspecialchars($_REQUEST['Service']); ?>" /><br /> 117 Operation:<input type="text" name="Operation" value="<?php echo htmlspecialchars($_REQUEST['Operation']); ?>" /><br /> 118 <?php 119 for ($i = 0; $i < 10; $i++) { 120 echo 'ExtArg[' . $i . ']:<input type="text" name="arg_key' . $i . '" value="' . htmlspecialchars($_REQUEST['arg_key' . $i]) . '" />:' 121 . '<input type="text" name="arg_val' . $i . '" value="' . htmlspecialchars($_REQUEST['arg_val' . $i]) . '" /><br />'; 122 } 123 ?> 124 AccessKeyId: <input type="text" name="AccessKeyId" value="<?php echo htmlspecialchars($_REQUEST['AccessKeyId']); ?>" /> 125 SecretKey: <input type="text" name="SecretKey" value="<?php echo htmlspecialchars($_REQUEST['SecretKey']); ?>" /> <br /> 126 <input type="button" value="Signature生成⇒" onclick="makeSignature();" /> 127 Timestamp: <input type="text" name="Timestamp" value="<?php echo htmlspecialchars($_REQUEST['Timestamp']); ?>" /> Signature: <input type="text" name="Signature" id="Signature" value="<?php echo htmlspecialchars($_REQUEST['Signature']); ?>" readonly /><br /> 128 <?php if($check_str != "") { 129 echo "<pre>{$check_str}</pre><br />"; 130 } ?> 131 <input type="submit" /> 132 </form> 133 <hr /> 134 REST URI: <a href="<?php echo $url;?>">Link</a><br /> 135 <textarea rows="1" cols="60"><?php echo htmlspecialchars($url);?></textarea> 136 <hr /> 137 Response:<br /> 138 <textarea rows="5" cols="100"> 139 <?php echo htmlspecialchars($response);?> 140 </textarea> 141 </pre> 142 <hr /> 143 Response decode:<br /> 144 <pre> 145 <?php 146 if($type =="json.php") { 147 var_dump(json_decode($response)); 148 }else if($type=="xml.php") { 149 $xml = simplexml_load_string($response); 150 var_dump($xml); 151 var_dump(libxml_get_errors () ); 152 }else if($type=="php.php") { 153 var_dump(unserialize($response)); 154 } 155 ?> 156 </pre> 157 <hr /> 158 <?php if($type=="json.php" && $_REQUEST['Signature'] == "") {?> 159 JavaScript:<div id="res"></div> 160 <hr /> 161 <pre id="dump"></pre> 162 <hr /> 163 164 <script type="text/javascript">//<![CDATA[ 165 var query_params = { 166 Service: '<?php echo $_REQUEST['Service'];?>', 167 Operation: '<?php echo $_REQUEST['Operation'];?>' 168 <?php 169 for($i =0; $i <10; $i++) { 170 if($_REQUEST['arg_key' . $i] != "") { 171 echo ',' . $_REQUEST['arg_key' . $i] . ': \'' . $_REQUEST['arg_val' . $i] . '\'' . "\n"; 172 } 173 } 174 ?> 175 }; 176 $(function(){ 177 var recvdata = function(data,textstatus) { 178 $('#res').text(textstatus); 179 var str = var_dump(data); 180 $('#dump').text(str); 181 } 182 var recverror = function (result, textstatus, errorThrown) { 183 $('#res').text(textstatus); 184 } 185 $.ajax({ 186 type: "GET", 187 url: "<?php echo $_REQUEST['EndPoint'];?>json.php", 188 dataType: 'json', 189 data: query_params, 190 success: recvdata, 191 error: recverror 192 }); 193 }); 194 //]]></script> 195 <?php } ?> 196 197 </body> 198 </html> 106 ※このプログラムに
Note: See TracChangeset
for help on using the changeset viewer.