【发布时间】:2013-09-25 00:56:05
【问题描述】:
我正在尝试创建一个按钮并使用 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 为空。
感谢您的帮助。
【问题讨论】:
-
当我回显时,$output 看起来像这样:s10.postimg.org/3pll2rt1l/Cloud_Flare_error.jpg
标签: php api button callback bitcoin