通过 PHP 解析来自 Gnip.com 的 POST

发布于 2024-07-24 05:42:20 字数 483 浏览 4 评论 0原文

我在 Gni​​p.com 上设置了一个过滤器。 在“POST URL”字段中,我输入了脚本 URL。 该 URL 是正确的,因为 Gnip.com 确实调用了它。 但是当调用脚本时,我没有得到任何数据。 我尝试解析 $_GET 和 $_POST 但两者都是空数组。 getallheaders() 给我一些数据,但没有 XML。 如何获取 Gnip.com 发送的 XML?

我不想使用任何包,因为我只需要获取 Gnip.com 发送给我的 XML 数据。

我希望你可以帮助我。 提前致谢!

Gnip.com 的“POST URL”描述: “POST URL:这是一个可选 URL,Gnip 将 POST 更新到该 URL。该 URL 必须能够响应 HEAD 请求。 示例: http://pivotallabs.com "

I've set up a filter at Gnip.com. In the field "POST URL" I've typed in my script URL. The URL is correct since Gnip.com really calls it. But when the script is called, I don't get any data. I've tried to parse $_GET and $_POST but both are empty arrays. getallheaders() gives me some data but no XML. How do I get the XML sent by Gnip.com?

I don't want to use any package since I only need to fetch the XML data which is sent to me by Gnip.com.

I hope you can help me. Thanks in advance!

Description of "POST URL" by Gnip.com:
"POST URL: This is an optional URL that Gnip will POST updates to. The URL must be able to respond to a HEAD request.
Example: http://pivotallabs.com "

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

叹倦 2024-07-31 05:42:20

要获取 POST 请求的原始正文,请使用:

$data = file_get_contents("php://input");

To get raw body of POST request, use:

$data = file_get_contents("php://input");
梦幻之岛 2024-07-31 05:42:20

查看 gnip-php 而不是重新发明轮子

Check out gnip-php instead of reinventing the wheel

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文