您好我需要接收一个以base64 格式编码的xml 格式的发布数据。我将从支付网关收到此信息。现在我得到的就是这个。我的代码创建了一个 txt 文件,但它是空的。代码有什么问题吗?输出应该是文本文件中的 xml 信封。
$body = '';
$fh = @fopen('php://input', 'r');
if ($fh)
{
while (!feof($fh))
{
$s = fread($fh, 1024);
echo $s;
if (is_string($s))
{
$body .= $s;
}
}
fclose($fh);
}
$body = base64_decode($body);
$ourFileName = "testFile.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $body;
fwrite($fh, $stringData);
fclose($fh);
我尝试联系支付网关,他们告诉我他们收到此错误“远程服务器返回错误:(417) 预期失败。” 问题可能存在于我们或他们哪里?