帮助破译支付网关代码
我不得不接管一个项目,其中有人退出并需要帮助了解某种类型的网关如何工作。如果我知道使用了什么网关,那就很容易了,但不幸的是我们不知道计划是什么。
有人可以帮我弄清楚它实际上是如何与网关通信的吗?在我看来,代码正在向自己发送请求?这是否意味着服务器已配置为处理网关请求?对于其他网关,例如 paypal,我习惯于直接向其服务器发送 HTTP 请求。
主机上是否存在驻留在主机上的网关类型?这里真的很困惑。
$payClientIP = "127.0.0.1";
$payClientPort = "9050";
$payClientSocket = -1;
$payClientTimeout = 5;
$payClientSocket = fsockopen($payClientIP, $payClientPort, $errno, $errstr, $payClientTimeout);
function sendCommand($payClientSocket, $command) {
global $payClientTimeout;
socket_set_timeout($payClientSocket, $payClientTimeout);
$buf = $command . "\n";
$response = fputs($payClientSocket, $buf) == strlen($buf);
}
sendCommand($payClientSocket, "7,CardSecurityCode,$cscValue");
sendCommand($payClientSocket, "7,CardNum,$cardNumber");
sendCommand($payClientSocket, "7,CardExp,$cardExpiry");
sendCommand($payClientSocket,"6,$orderInfo,$merchantID,$amount,$locale");
我试图找到的是物理发送请求的命令,但我找不到。该代码实际上可以工作并借记该卡。
I had to take over a project where someone quit and need help understanding about how a type of gateway might work. It would be easy if I knew what gateway was used, but unfortunately we are unaware of what the plan was.
Can someone help me figure out how this actually communicates with a gateway? It seems to me like the code is sending itself the request?? Does this mean that the server is configured to handle the gateway request? With other gateways, like paypal, I'm used to just sending an HTTP request to their servers directly.
Are there types of gateways that reside on the host machine? Really confused here.
$payClientIP = "127.0.0.1";
$payClientPort = "9050";
$payClientSocket = -1;
$payClientTimeout = 5;
$payClientSocket = fsockopen($payClientIP, $payClientPort, $errno, $errstr, $payClientTimeout);
function sendCommand($payClientSocket, $command) {
global $payClientTimeout;
socket_set_timeout($payClientSocket, $payClientTimeout);
$buf = $command . "\n";
$response = fputs($payClientSocket, $buf) == strlen($buf);
}
sendCommand($payClientSocket, "7,CardSecurityCode,$cscValue");
sendCommand($payClientSocket, "7,CardNum,$cardNumber");
sendCommand($payClientSocket, "7,CardExp,$cardExpiry");
sendCommand($payClientSocket,"6,$orderInfo,$merchantID,$amount,$locale");
What I'm trying to locate is the command to physically send the request, but I cannot find one. The code actually works and debits the card.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能应该检查本地计算机上是否有使用侦听器运行的服务应用程序,该应用程序实际上在幕后执行实际工作。我的团队曾经使用过一个特定的应用程序,需要类似的设置,我们引入了一个 Web 服务,该服务可以将信用信息发送到供应商的服务。
但是,如果服务与调用网页托管在同一台计算机上,我不会看到此设置的优势。
You should probably check for a service application running with a listener on the local machine that's actually doing the real work behind the scenes. There was a particular application that my team worked with once that required a similar setup, and we introduced a web service that turned around and fired the credit info to the vendor's service.
However, I wouldn't see the advantage of this setup in the case of the service being hosted on the same machine as the calling web page.
您本地计算机上的端口 9050 上正在运行某些内容。仅凭您提供的信息很难弄清楚它在做什么。它可能是一个网关,也可能只是某种将请求传递到某个远程网关的日志代理。
Something's running on port 9050 on your local machine. It'd be hard to figure out what that is doing with just the information you've provided. It could be a gateway, or it could just be some sort of logging proxy that's passing the request onto a remote gateway somewhere.