当我json
使用 - 我将数据发布到 API时curl
,我没有得到任何输出。我想向收件人发送电子邮件邀请。
$url_send ="http://api.address.com/SendInvitation?";
$str_data = json_encode($data);
function sendPostData ($url, $post) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
return curl_exec($ch);
}
这是JSON
$str_data
[
{
"authorizedKey" : "abbad35c5c01-xxxx-xxx",
"senderEmail" : "myemail@yahoo.com",
"recipientEmail" : "jaketalledo86@yahoo.com",
"comment" : "Invitation",
"forceDebitCard" : "false"
}
]
并调用函数:
$response = sendPostData($url_send, $str_data);
这是 API:https ://api.payquicker.com/Help/Api/POST-api-SendInvitation