我正在尝试创建一个按钮并使用 coinbase 分配一个回调 URL。
尝试发布到 coinbase API 时,我收到了一些返回的验证码数据。
我认为我的虚拟主机被 CloudFlare 阻止,从而禁用了我的代码。
这是我所拥有的:
<a class="coinbase-button" data-code="<?php
$data = array(
"button" => array(
"name" => "Ticket",
"price_string" => "0.01",
"price_currency_iso" => "BTC",
"custom" => $OrderNext . "- " . $ticket,
"callback_url" => "https://x.com/callback.php",
"description" => "Ticket - " . $ticket ,
"type" => "buy_now",
"style" => "buy_now_large"
)
);
$json_data = json_encode($data);
$ch = curl_init("https://coinbase.com/api/v1/buttons?api_key=xxxxxxxxxxxxxxxxxxxxxx");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($json_data))
);
if( ! $output = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
$result = json_decode($output);
$output
返回验证码页面。
$result
一片空白。
谢谢你的帮助。