How to check whether my ipn page is called by coinbase ping webhook notification





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I have built a website using CodeIgniter and php coinbase API. I have ipn file located at /var/www/html/ with 0777 permission. It is not being called when deposits are made to my coinbase BTC wallet. Other API calls like creating wallet addresses, listing transactions are working fine.



Below is code from coinbasedepositipn.php file. The file pushes the notification raw body received to a method in Notifications controller using curl.



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.";
}


So I want to send "ping" notification to my server to check if everything is ok with my ipn file. Description of their API is saying that "Ping notification can be sent at any time to verify that the notification URL is functioning" But can't find how to send ping to my ipn page and know that my file is accessible from coinbase server endpoint.



Hope you can help me to find a way to send a ping notification. Thanks in advance.










share|improve this question































    1















    I have built a website using CodeIgniter and php coinbase API. I have ipn file located at /var/www/html/ with 0777 permission. It is not being called when deposits are made to my coinbase BTC wallet. Other API calls like creating wallet addresses, listing transactions are working fine.



    Below is code from coinbasedepositipn.php file. The file pushes the notification raw body received to a method in Notifications controller using curl.



    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.";
    }


    So I want to send "ping" notification to my server to check if everything is ok with my ipn file. Description of their API is saying that "Ping notification can be sent at any time to verify that the notification URL is functioning" But can't find how to send ping to my ipn page and know that my file is accessible from coinbase server endpoint.



    Hope you can help me to find a way to send a ping notification. Thanks in advance.










    share|improve this question



























      1












      1








      1


      1






      I have built a website using CodeIgniter and php coinbase API. I have ipn file located at /var/www/html/ with 0777 permission. It is not being called when deposits are made to my coinbase BTC wallet. Other API calls like creating wallet addresses, listing transactions are working fine.



      Below is code from coinbasedepositipn.php file. The file pushes the notification raw body received to a method in Notifications controller using curl.



      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.";
      }


      So I want to send "ping" notification to my server to check if everything is ok with my ipn file. Description of their API is saying that "Ping notification can be sent at any time to verify that the notification URL is functioning" But can't find how to send ping to my ipn page and know that my file is accessible from coinbase server endpoint.



      Hope you can help me to find a way to send a ping notification. Thanks in advance.










      share|improve this question
















      I have built a website using CodeIgniter and php coinbase API. I have ipn file located at /var/www/html/ with 0777 permission. It is not being called when deposits are made to my coinbase BTC wallet. Other API calls like creating wallet addresses, listing transactions are working fine.



      Below is code from coinbasedepositipn.php file. The file pushes the notification raw body received to a method in Notifications controller using curl.



      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.";
      }


      So I want to send "ping" notification to my server to check if everything is ok with my ipn file. Description of their API is saying that "Ping notification can be sent at any time to verify that the notification URL is functioning" But can't find how to send ping to my ipn page and know that my file is accessible from coinbase server endpoint.



      Hope you can help me to find a way to send a ping notification. Thanks in advance.







      php codeigniter webhooks coinbase-api coinbase-php






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 24 '18 at 4:14









      dmulter

      1,4943918




      1,4943918










      asked Nov 23 '18 at 6:11









      SMJSMJ

      179616




      179616
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441431%2fhow-to-check-whether-my-ipn-page-is-called-by-coinbase-ping-webhook-notification%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441431%2fhow-to-check-whether-my-ipn-page-is-called-by-coinbase-ping-webhook-notification%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

          ComboBox Display Member on multiple fields

          Is it possible to collect Nectar points via Trainline?