title: I'm trying to validate the callback send to my website in php
body: <p>I'm trying to validate the callback send to my website in php.</p>
  <p>Please I'm trying to use this api documentation <a href="https://support.cryptapi.io/article/how-to-verify-the-callback-signature" rel="nofollow noreferrer">https://support.cryptapi.io/article/how-to-verify-the-callback-signature</a> to validate the callback send to my website but my code keep showing error to the api</p>
  <p>I don't know whether it from my code</p>
  <pre><code>&lt;?php
  
  
  $pubkey = 
  &quot;-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC3FT0Ym8b3myVxhQW7ESuuu6lo\ndGAsUJs4fq+Ey//jm27jQ7HHHDmP1YJO7XE7Jf/0DTEJgcw4EZhJFVwsk6d3+4fy\nBsn0tKeyGMiaE6cVkX0cy6Y85o8zgc/CwZKc0uw6d5siAo++xl2zl+RGMXCELQVE\nox7pp208zTvown577wIDAQAB\n-----END PUBLIC KEY-----&quot;;       
  
  
  $signature = base64_decode($_SERVER['HTTP_X_CA_SIGNATURE']);
  $algo = OPENSSL_ALGO_SHA256;
  
  // if request is GET
  $data = &quot;https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]&quot;;
  
  // if request is POST
  $data = file_get_contents('php://input');
  
  if (openssl_verify($data, $signature, $pubkey, $algo) == 1) {
  
  
  
  require &quot;cryptapi.php&quot;;
  $url = $_GET['userdata'];
  
  $postdata = CryptAPI\CryptAPI::process_callback($_GET);
  $amount = $postdata['value_coin'];
  $txid_in = $postdata['txid_in'];
  
  $data = array(
      'amount' =&gt; $amount,
      'txid_in' =&gt; $txid_in
  );
  
  $payload = json_encode($data);
  
  // Prepare new cURL resource
  $ch = curl_init(urldecode($url));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLINFO_HEADER_OUT, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
  
  // Set HTTP Header for POST request 
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      'Content-Type: application/json',
      'Content-Length: ' . strlen($payload))
  );
  
  // Submit the POST request
  $result = curl_exec($ch);
  
  // Close cURL session handle
  curl_close($ch);
  
  echo &quot;*ok*&quot;;
  
  
  } else {
  echo &quot;error&quot;;
      // signature NOT valid
  }
  ?&gt;
  </code></pre>