0

我正在尝试使用带有以下源代码的 click bank api 发起退款。

$ch = curl_init();
$qry_str="?type=rfnd&comment=API refund check&reason=7&refundType=FULL";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.clickbank.com/rest/1.3/tickets/N5GNE72J'.$qry_str);
curl_setopt($ch, CURLOPT_HEADER, true); 
//curl_setopt($ch, CURLOPT_GET, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'GET');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml", "Authorization:DEV-xxxxxxxxx:API-yyyyyyyyyyyy"));
$result = curl_exec($ch);
curl_close($ch);

print $result;


我使用了以下两个网址作为参考:

  1. https://api.clickbank.com/api/api_13_examples/api_example.php
  2. https://api.clickbank.com/rest/1.3/tickets

执行上述代码后,它显示一个空白屏幕,没有任何显示,我的错误标志设置为 1 仍然没有显示错误。

4

1 回答 1

0

经过长时间的斗争,找到了解决办法。使用下面的代码,它对我有用。

 <?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
    "https://api.clickbank.com/rest/1.3/tickets/627JE7CZ/?type=rfnd&comment=&reason=ticket.type.refund.7&refundType=FULL");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
/**
 * ClickBank doesn't allow POST parameters to be sent in; however, for the CURL POST to work correctly, the
 * CURL_POSTFIELDS option must be set, so we'll just set it to empty and put all our request parameters on the URL
 */
curl_setopt($ch, CURLOPT_POSTFIELDS, "");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Accept: application/xml",
    "Authorization:DEV-enter your dev key here:API-enter your clerk key here"
));
$result = curl_exec($ch);
curl_close($ch);
?>
于 2014-09-02T10:34:35.650 回答