For full functionality of this site it is necessary to enable JavaScript.
Here are the instructions how to enable JavaScript in your web browser.

Knowledge base

Find the answer to your question

Advanced Search PView

Search terms
Search Type
Product
Category
Language
Format
SDK
Sort by
Direction

eBay Notifications Listener PHP sample - incomplete/cut-off Payloads problem with PHPinput stream capturing

  • Answer ID 2032
  • Published 09/12/2016 08:00 PM
  • Updated 09/12/2016 08:00 PM
  • Permalink https://ebaydts.com/eBayKBDetails?KBid=2032
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

Print Email This Page Delicious Digg Facebook Reddit StumbleUpon Twitter