【发布时间】:2017-02-22 14:57:25
【问题描述】:
有人可以帮助我吗?我正在尝试通过以下代码发出请求,但是发生任何事情,都会出现任何消息。我相信我的代码是正确的:
public function subscribe(){
$json_url = 'https://apisandbox.cieloecommerce.cielo.com.br/1/sales/';
$json_string = json_encode(array(
"MerchantOrderId"=>"2014113245231706",
"Customer" => array(
"Name" => "Comprador rec programada"
),
"Payment" => array(
"Type" => "CreditCard",
"Amount" => 1500,
"Installments" => 1,
"SoftDescriptor" => "Assinatura Fraldas"
)
));
$ch = curl_init($json_url);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
CURLOPT_POSTFIELDS => $json_string
);
curl_setopt_array( $ch, $options );
$result = curl_exec($ch); // Getting jSON result string
print_r($result);
}
找到网站说明的链接:
【问题讨论】:
-
您应该调试您的 curl 请求...查看 api 文档中的请求标头,您必须发送更多标头