快钱pos接口问题
洪大少 2016-01-26 09:15:36 代码:
<style type="text/css">
font{color:blue}
</style>
<?PHP
$word = new COM("NLUnitPad.NLUnitPad")or die("Unable to instanciate Word");
if($_POST[submit]){
echo $word->OpenComm(3,57600,60);
echo '<HR>';
$tr_info=$_POST[TransType].$_POST[Amount].$_POST[POSID].$_POST[OperatorID].$_POST[TransTime].$_POST[OrderID].$_POST[xxx].$_POST[xxx].$_POST[xxx].$_POST[Old_trace].$_POST[Old_DateTime].$_POST[Old_authcode].$_POST[Remark];
echo 'tr_info<BR>'.$tr_info.'<BR>';
echo '<BR>'.$word->API_SendReq('98',$tr_info).'<HR>';
}
echo '返回:<BR>';
$result=$word->API_RecvResp();
echo '<HR>交易类型TransType:<font>'.substr($result,0,2).'</font> 00-消费;02-撤消;20-退货;04-预授权完成;05-预授权撤消;06-预授权完成撤消; FF 返回失败';
echo '<HR>交易返回代码ResponseCode:<font> '.substr($result,2,2).'</font> 00成功; 非00失败';
echo '<HR>卡号前6位后4位CardID:<font> '.substr($result,4,10).'</font>';
echo '<HR>卡类型CardType: <font>'.substr($result,14,10).'</font>';
echo '<HR>系统参考号SysReference:<font> '.substr($result,24,12).'</font>';
echo '<HR>交易时间TransTime:<font> '.substr($result,36,10).'</font>';
echo '<HR>交易金额Amount: <font>'.substr($result,46,12).'</font>';
echo '<HR>交易凭证号trace:<font> '.substr($result,58,6).'</font>';
echo '<HR>交易授权号authcode:<font> '.substr($result,64,6).'</font>';
echo '<HR>终端号Teminal_id: <font>'.substr($result,70,8).'</font>';
echo '<HR>错误信息ErrorInfo:<font> '.substr($result,78,48).'</font>';
echo '<HR>保留Remark: <font>'.substr($result,126,20).'</font>';
echo '<HR>';
if($_POST[close]){
if($word->CloseComm()){
echo '<H1>关闭成功</H1>';
}else{
echo '<H1>关闭失败</H1>';
};
}
?>
<form method=post action="" name="">
<input type="submit" value="关闭端口" name="close" >
</form>
<style type="text/css">
span{color:red}
</style>
<h1>消费</h1>
如果 为空请用 <BR>
&*nbsp;
(去掉*)
</BR>
<form method=post action="" name="">
<table cellspacing="0" cellpadding="10" border="1">
<tr>
<td>(2B)TransType <span class="">*</span></td>
<td><input type="text" name="TransType" value="00" /></td>
<td>交易类型:00-消费;02-撤消;20-退货;03-预授权;04-预授权完成;05-预授权撤;06-预授权完成撤消</td>
</tr>
<tr>
<td>(12B)Amount <span class="">*</span></td>
<td><input type="text" name="Amount" value="000000000100" maxlength=12 /></td>
<td>分为单位不够12位 补0</td>
</tr>
<tr>
<td>(8B)POSID(商户销售终端编号) <span class="">*</span></td>
<td><input type="text" name="POSID" value="13000696" /></td>
<td></td>
</tr>
<tr>
<td>(4B)OperatorID(收款员编号) <span class="">*</span></td>
<td><input type="text" name="OperatorID" value="0001" /></td>
<td></td>
</tr>
<tr>
<td>(10B)TransTime(交易时间) <span class="">*</span></td>
<td><input type="text" name="TransTime" value="<?PHP echo date(mdHis); ?>" /></td>
<td></td>
</tr>
<tr>
<td>(20B)OrderID(交易定单编号) <span class="">*</span></td>
<td><input type="text" name="OrderID" value="<?PHP echo date(YmdHissss); ?>" /></td>
<td>20位长度</td>
</tr>
<tr>
<td>(6B)Old_trace(原交易凭证号) <span class="">*</span></td>
<td><input type="text" name="Old_trace" value=" " maxlength=6 /></td>
<td>退货时填写(原交易返回信息获得,如果没有,空格补充)</td>
</tr>
<tr>
<td>(10B)Old_DateTime(原交易时间) <span class="">*</span></td>
<td><input type="text" name="Old_DateTime" value=" " maxlength=10 /></td>
<td>(月月日日时时分分秒秒)(原交易返回信息获得,如果没有,空格补充)</td>
</tr>
<tr>
<td>(6B)Old_authcode(原交易授权号) <span class="">*</span></td>
<td><input type="text" name="Old_authcode" value=" " maxlength=6 /></td>
<td>(原交易返回信息获得,如果没有,空格补充)</td>
</tr>
<tr>
<td>(20B)Remark(保留) <span class="">*</span></td>
<td><input type="text" name="Remark" value=" " maxlength=20 /></td>
<td></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="gooooooooooooooo"></td>
</tr>
</table>
</form>
错误:
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `NLUnitPad.NLUnitPad': 无效的语法 ' in D:\APMServ5.2.6\www\htdocs\cp-php\xiaofei.php:8 Stack trace: #0 D:\APMServ5.2.6\www\htdocs\cp-php\xiaofei.php(8): com->com('NLUnitPad.NLUni...') #1 {main} thrown in D:\APMServ5.2.6\www\htdocs\cp-php\xiaofei.php on line 8
有人说要regsvr32.exe文件注册,但是注册过了,还是出现错误,麻烦大神给小弟指导一下