【发布时间】:2017-08-15 09:55:31
【问题描述】:
上图是我的代码的结果。我怎样才能删除它?我不想使用库,我想在使用库之前学习如何使用 PHP curl。
<?php
function DeleteCustomer() {
$array = array(
'id' => 'cus_AKjDJGDrHovimg'
);
$ch = curl_init();
$headers = array('Authorization: Bearer xxxxxxxxxxxxxxxxxxxxx');
curl_setopt($ch, CURLOPT_URL,'https://api.stripe.com/v1/customers');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array));
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$output=curl_exec($ch);
curl_close($ch);
$output = json_decode($output,true);
return $output;
}
$a = DeleteCustomer();
print_r($a);
?>
感谢那些愿意回答的人。
【问题讨论】:
-
为什么
curl_setopt($ch, CURLOPT_POST, 1);??
标签: php curl stripe-payments