• 27-04-2018, 15:39:54
    #1
    Merhaba,Kişiye özel one signal ile push gönderme şansım varmı acaba?

    [COLOR=initial]<?php[/COLOR]
    //One signal
    class oneSignal
    {
        public $apiKey = 'ddddd'; // Api Key
    
    
        private $restApiKey = 'aaaaaa'; // Rest Api Key
    
    
        function __construct()
        {
            return $this->apiKey;
        }
    
    
        public function sendMessage($messageEn , $url = null)
        {
            $content = array(
                'en' => $messageEn
            );
    
    
            $data = array(
                'app_id' => $this->apiKey,
                'included_segments' => array('All'),
                'contents' => $content,
                'url' => $url
            );
            $data = json_encode($data);
    
    
            $curl = curl_init();
            curl_setopt_array($curl, array(
                CURLOPT_URL => 'https://onesignal.com/api/v1/notifications',
                CURLOPT_RETURNTRANSFER => TRUE,
                CURLOPT_HEADER => FALSE,
                CURLOPT_POST => TRUE,
                CURLOPT_POSTFIELDS => $data,
                CURLOPT_SSL_VERIFYPEER => FALSE,
                CURLOPT_HTTPHEADER => array(
                    'Content-Type: application/json; charset=utf-8',
                    'Authorization: Basic '.$this->restApiKey
                ),
            ));
            $response = curl_exec($curl);
            curl_close($curl);
    
    
    
    
        }
    
    
    }
    
    
    $ad = 'nurettin';
    $url ='https://www.google.com/';
    
    
    $oneSignal = new oneSignal();
    $oneSignal->sendMessage($ad, $url);
    
    
    //one signal
    
    
    ?>
  • 27-04-2018, 15:48:13
    #2
    <?PHP
    function sendMessage()
    {
        $content = array(
            "en" => 'English Message'
        );
    
        $fields = array(
            'app_id' => "5eb5a37e-b458-11e3-ac11-000c2940e62c",
            'include_player_ids' => array(
                "6392d91a-b206-4b7b-a620-cd68e32c3a76",
                "76ece62b-bcfe-468c-8a78-839aeaa8c5fa",
                "8e0f21fa-9a5a-4ae7-a9a6-ca1f24294b86"
            ) ,
            'data' => array(
                "foo" => "bar"
            ) ,
            'contents' => $content
        );
    
        $fields = json_encode($fields);
        print ("\nJSON sent:\n");
        print ($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; charset=utf-8',
            'Authorization: Basic NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj'
        ));
        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);
    
    print ("\n\nJSON received:\n");
    print ($return);
    print ("\n");
    ?>
    https://documentation.onesignal.com/...e-notification
    bu adreste sanırım istediğiniz şey var
  • 27-04-2018, 17:00:22
    #3
    YuqseLX adlı üyeden alıntı: mesajı görüntüle
    <?PHP
    function sendMessage()
    {
        $content = array(
            "en" => 'English Message'
        );
    
        $fields = array(
            'app_id' => "5eb5a37e-b458-11e3-ac11-000c2940e62c",
            'include_player_ids' => array(
                "6392d91a-b206-4b7b-a620-cd68e32c3a76",
                "76ece62b-bcfe-468c-8a78-839aeaa8c5fa",
                "8e0f21fa-9a5a-4ae7-a9a6-ca1f24294b86"
            ) ,
            'data' => array(
                "foo" => "bar"
            ) ,
            'contents' => $content
        );
    
        $fields = json_encode($fields);
        print ("nJSON sent:n");
        print ($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; charset=utf-8',
            'Authorization: Basic NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj'
        ));
        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);
    
    print ("nnJSON received:n");
    print ($return);
    print ("n");
    ?>
    https://documentation.onesignal.com/...e-notification
    bu adreste sanırım istediğiniz şey var
    Teşekkurler o sayfada bulamamıştım.