• 31-08-2019, 00:51:08
    #1
    Üyeliği durduruldu
    https://www.r10.net/php/2121096-ones...derim-php.html

    İhtiyacı olanlar buradan ulaşabilir.
  • 31-08-2019, 01:04:06
    #2
    onesignali googlefirebase ye bağlayıp dediğinizi sizde yapabilirsiniz hocam
  • 31-08-2019, 01:06:26
    #3
    Üyeliği durduruldu
    Kei adlı üyeden alıntı: mesajı görüntüle
    onesignali googlefirebase ye bağlayıp dediğinizi sizde yapabilirsiniz hocam
    Firebase, onesignale bağlıyor zaten hocam.
  • 31-08-2019, 14:46:03
    #4
    Ö.M detaylı olarak dönüş sağladım. Lakin forum içerisinde benzer bir mesajın gönderilmesi için yazılmış basit bir php kodu mevcut.



    Cankat adlı üyeden alıntı: mesajı görüntüle
    Evet apisi var hocam kendi sitesindeki kod şöyle, kendime uyarlayarak kullandım.

    <?PHP
    function sendMessage(){
    $content = array(
    "en" => 'English Message'
    );
    
    $fields = array(
    'app_id' => "5eb5a37e-b458-11e3-ac11-000c2940e62c",
    'filters' => array(array("field" => "tag", "key" => "level", "relation" => "=", "value" => "10"),array("operator" => "OR"),array("field" => "amount_spent", "relation" => "=", "value" => "0")),
    '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");
    ?>
  • 31-08-2019, 14:48:09
    #5
    Üyeliği durduruldu
    1 saate pcye geçiyorum. Kendi kodumu atacağım buraya basit kullanım



    Php kodu:
    function sendMessage($mesaj){
            $content = array(
                "en" => $mesaj
                );
            
            $fields = array(
                'app_id' => "$APP IDIYI BURAYA GİR",
                'included_segments' => array('All'),
                '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 API KEYİ BURAYA GİR'));
            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;
        }
  • 31-08-2019, 15:16:10
    #6
    Üyeliği durduruldu
    halilx35 adlı üyeden alıntı: mesajı görüntüle
    1 saate pcye geçiyorum. Kendi kodumu atacağım buraya basit kullanım




    Php kodu:
    function sendMessage($mesaj){
            $content = array(
                "en" => $mesaj
                );
            
            $fields = array(
                'app_id' => "$APP IDIYI BURAYA GİR",
                'included_segments' => array('All'),
                '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 API KEYİ BURAYA GİR'));
            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;
        }
    Çok Teşekkürler.
  • 31-08-2019, 15:30:57
    #7
    @Mahien; Benim teşekkürüm nerede ?
  • 31-08-2019, 17:07:06
    #8
    Üyeliği durduruldu
    https://www.r10.net/php/2121096-ones...derim-php.html

    İhtiyacı olanlar buradan ulaşabilir.