Posting json data to API using curl
Hey everyone when I post json data to API using curl im not getting any
output, I would like to send email invitation to recipient. my code.
$url_send ="http://api.payquicker.com/api/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);
This is the API: https://api.payquicker.com/Help/Api/POST-api-SendInvitation
No comments:
Post a Comment