I'm trying to send an image along with notification via php!

0

I'm trying to send an image next to the notification via php, the notification is sent normally, but the image will not. Can you tell me what's wrong with this code?

<?php


if (isset($_POST['titulo'])) {

    move_uploaded_file($_FILES['Imagem']['tmp_name'], 'Imagens/' . $_FILES['Imagem']['name']);


    function sendMessage()
    {
        $content = array(
            "en" => $_POST['mensagem']
        );

        $imagem = $_FILES['Imagem'];
        $headings = array("en" => $_POST['titulo']);
        $fields = array(
            'app_id' => "2ac0abda-15ae-4d27-aa5b-da8400941d97",
            'included_segments' => array('All'),
            'contents' => $content,
            'headings' => $headings,
            //'small_icon'
            'large_icon' => 'https://www.iconexperience.com/_img/v_collection_png/64x64/shadow/ok.png', //  Ok
            'big_picture' => $imagem, //  Ok
            // 'android_led_color' => "FF0000FF",
            //'notification[android_accent_color]' => "FF0000FF",

        );


        $fields = json_encode($fields);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications");
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
            'Authorization: Basic M2I5MDEzYTItN2VkYS00YTVhLWE0OWMtMzY3MzNkOTU3NWQ3'));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_HEADER, FALSE);
        curl_setopt($ch, CURLOPT_POST, TRUE);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

        $response = curl_exec($ch);
        curl_close($ch);

        return $response;

    }

    $response = sendMessage();
    $return["allresponses"] = $response;
    $return = json_encode($return);

}
    
asked by anonymous 25.01.2017 / 19:15

0 answers