I've been trying to get this to work for the past 3 days and I've all but given up on it. Basically, I've used requestb.in to monitor if any POST requests are going through; requestb.in always displays a response. However, I can't replicate this on my own website.
I simply can't find a way to read the body of the response that's getting called back to my server.
For reference, I'm using this sample provided by BlockCypher:
require __DIR__ . '/../bootstrap.php';
$webHook = new \BlockCypher\Api\WebHook();
$webHook->setUrl("http://mysite.com/dev/data/index.php");
$webHook->setEvent('unconfirmed-tx');
/// For Sample Purposes Only.
$request = clone $webHook;
$webHookClient = new \BlockCypher\Client\WebHookClient($apiContexts['BTC.main']);
/// Create WebHook
try {
$output = $webHookClient->create($webHook);
} catch (Exception $ex) {
ResultPrinter::printError("Created WebHook", "WebHook", null, $request, $ex);
exit(1);
}
ResultPrinter::printResult("Created WebHook", "WebHook", $output->getId(), $request, $output);
return $output;
I had tested the callback url using requestb.in:
http://requestb.in/zphhv1zp?inspect
I've been going crazy testing everything I could find online, but nothing really helped me out. What should I be using to retrieve the POST data?
PS: this is the code that I've been testing most recently
<html lang="en">
<head>
</head>
<body>
<?php
$url = "http://requestb.in/zphhv1zp";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
echo $data;
// $inputJSON = file_get_contents('');
// $input = json_decode( $inputJSON, TRUE );
// echo $input['hash'];
?>
</body>
</html>