Not able to create an API call in php
Posted: 22. Mar 2020, 17:25
Hi,
I haven't managed to create a successfull API call in PHP, i tried a number of variations.
My connection is secure, can anyone point me in the right direction?
I haven't managed to create a successfull API call in PHP, i tried a number of variations.
My connection is secure, can anyone point me in the right direction?
Code: Select all
<?php
$message= 'hi'
$ch = curl_init();
$data = array(
'm' => urldecode($message),
'k' => xxxxx
);
$postString = http_build_query($data, '', '&');
curl_setopt($ch, CURLOPT_URL, 'https://www.pushsafer.com/api' );
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false );
$response = curl_exec($ch);
curl_close($ch);
?>