我已经使用CodeIgniter和php coinbase API建立了一个网站。我有位于/ var / www / html /的ipn文件,权限为0777。当我向我的coinbase BTC钱包存款时,不会调用它。其他API调用(例如创建钱包地址,列出交易)都可以正常工作。
下面是来自coinbasedepositipn.php文件的代码。该文件使用curl将接收到的通知原始内容推送到Notifications控制器中的方法。
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$raw_body = file_get_contents('php://input');
$signature = $_SERVER['HTTP_CB_SIGNATURE'];
$data=array();
$data["rawbody"] = $raw_body ;
$data["signature"] = $signature;
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$url=$protocol.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/index.php/notifications/coinbasedepositipn";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$headers = [
"accept: application/json;charset=utf-8"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// Execute
$sitecontent = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
// Closing
curl_close($ch);
echo "$sitecontent <br><br> Notification done successfully.";
}
所以我想向服务器发送“ ping”通知,以检查ipn文件是否一切正常。他们对API的描述是说“可以随时发送ping通知以验证通知URL是否正常运行”,但是找不到如何将ping发送到我的ipn页面并知道可以从以下位置访问我的文件coinbase服务器端点。
希望您能帮助我找到一种发送ping通知的方法。预先感谢。