Skip to main content
Published: September 12 2016, 8:00:00 PMUpdated: November 28 2020, 10:24:11 PM

I am receiving cut off/incomplete Notification Payloads from eBay. I am using simple php script which send a 200OK response header and then captures the php input stream with file_get_contents(php://input ), which then is written to a log file.

We have found problems with capturing PHP input stream, and writing the payload to files. As mentioned in our code sample at: https://ebaydts.com/eBayKBDetails?KBid=1164

Please use $GLOBALS["HTTP_RAW_POST_DATA"] to capture the payload instead of file_get_contents(php://input). We have problems like clients retrieving cut-off and incomplete payloads, when they capture the PHP input stream. (Note that eBay sent complete payloads to the clients, but the cut-off problem was at the client's end).

Also, Make sure that you acknowledge the request from eBay by sending proper response (headers) before capturing the payload. Depending on the size of the payload, the time taken to capture the payload might vary and in occasions of time consumed more than three secs, a time out happens.

Essentially the flow should be like:

<?php

headers("Status: 200 OK");

headers("Content-Type: text/html ");// this is optional as PHP send this header by default.

$payLoad = $GLOBALS["HTTP_RAW_POST_DATA"] ;

$file = 'notifications.log';
file_put_contents($file, $payLoad);

?>

How well did this answer your question?
Answers others found helpful