回复服务器到服务器请求?

时间:2011-12-01 04:58:03

标签: php post google-checkout

我正在尝试在我的网站上设置谷歌结帐,现在在某一点,谷歌发给我一个序列号,我应该在发布'OK'标题后回复, (这里有一些细节http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Notification_API.html#responding_to_notifications

问题是,idk如何回复,我正在尝试这个:

{
header('HTTP/1.0 200 OK');
$post = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents("php://input");
$post = substr($post, 14);
$pr = @'<?xml version="1.0" encoding="UTF-8"?>
       <notification-acknowledgment xmlns="http://checkout.google.com/schema/2" serial-number="' . $post . '" />';
        echo $pr;

        if (isset($post)) {

         //Something with the DB..
 }

收到此确认后收到的通知谷​​歌将停止向我发送相同序列号的请求,但我继续收到请求(从数据库中知道这一点),暗示谷歌无法收到我的通知确认。

我在哪里错误&gt;'?

1 个答案:

答案 0 :(得分:0)

我做了一些搜索和一些命中试验,结果就是:

要进行服务器到服务器的回复,您只需回复您的回复即可。如果您需要传递任何标题,请在 之前传递 ,然后回显任何内容,

注意:如果您要在xml中发送回复,就像Google Checkout一样,请注意回显文本中的空格和换行符。

$pr = "<xyz>
123
</xyz>";

可能与$pr="<xyz>123</xyz>";

不同