public static function sendToSingleUser($title, $body, $targetUrl, $id)
{
$end_point = ‘https://api.webpushr.com/v1/notification/send/sid’;
$key = config(‘services.webpushr.webPushrKey’);
$token = config(‘services.webpushr.webPushrToken’);
$http_header = array(
"Content-Type: Application/Json",
"webpushrKey: $key",
"webpushrAuthToken: $token"
);
$req_data = array(
'title' => $title, //required
'message' => $body, //required
'target_url' => $targetUrl, //required
'sid' => $id //required
);
print_r($ch); die();
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $http_header);
curl_setopt($ch, CURLOPT_URL, $end_point );
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($req_data) );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
$response = curl_exec($ch);
if(curl_errno($ch)){
echo 'Request Error:' . curl_error($ch);
}
//var_dump($error_msg);
curl_close($ch);
}
$req_data and $http_header are correct. But error "The requested URL returned error: 409 " is showing
Can someone plz help me with this