使用PHP捕获CXML-Urlencoded.不是POST或GET [英] Catch CXML-Urlencoded with PHP. Not POST or GET
问题描述
除了POST,GET,COOKIE,SESSION和RAW之外,还有其他方法可以接收表格吗?
Is there other ways to receive a form other than POST, GET, COOKIE, SESSION and RAW?
我解释:我正在尝试用PHP实现cXML Punchout,但似乎我没有收到通常发送的信息.我尝试用PHP,GET,POST甚至原始方式捕获它:
I explain: I'm trying to implement cXML Punchout with PHP but it seems that I'm not receiveing the information as is usually sent. I try to catch it with PHP, GET, POST and even as raw:
file_get_contents('php://input')
但是我没有发现任何变种.
But I don't catch any var.
我找到了一个向程序发送虚拟请求的URL: https://punchoutcommerce. com/tools/cxml-punchout-tester
I found a URL to send a dummy request to my program: https://punchoutcommerce.com/tools/cxml-punchout-tester
如果我向我的程序发送请求( https://serlimax.com/api ),则不会在我的日志中注册任何内容,但我发现使用浏览器工具发送了CXML-Urlencoded.
If I send a request my program (https://serlimax.com/api) it does not register anything in my logs, but I see there were a CXML-Urlencoded sent using browser tools.
如何捕获我看到的信息?
How do I catch that that info I see?
pS:如果您想在浏览器中自己查看它,则可以发送除现有URL之外的任何信息,否则将发送404错误.
pS: If you want to see it by yourself in the browser you can send any info but an existing URL, otherwise it'll send a 404 error.
PS2:如果您想知道如何知道我什么都没收到,这就是我记录收到的信息的方式:
PS2: If you're wondering how do I know I'm not receiving anything, this is how I log the received info:
ob_flush();
ob_start();
echo "User: - ". $_SERVER['HTTP_USER_AGENT']. ' - IP:'. $_SERVER['REMOTE_ADDR'].' - METHOD:'.$_SERVER['REQUEST_METHOD'].PHP_EOL;
echo 'POST:---------'.PHP_EOL;
var_dump($_POST);
echo 'GET:---------'.PHP_EOL;
var_dump($_GET);
echo 'RAW:---------'.PHP_EOL;
echo file_get_contents('php://input');
file_put_contents('./punchout_log_'.date("j.n.Y.H.i.s").'.txt', ob_get_flush());
结果为空日志:
推荐答案
是我所不知道的,但这是由于使用了 https://url/api/index .php
Well it was out of my knowledge but it was due to be using https://url/api/, instead of https://url/api/index.php
"index.php"的隐藏导致了重定向,从而避免了php://input的捕获
The laking of "index.php" caused a redirection which avoid the catching of php://input
这篇关于使用PHP捕获CXML-Urlencoded.不是POST或GET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!