"Enter"a basıp içeriğe geçin

onesignal kullanımı

One signal kullanımı:

Chrome için istekde bulunma:

    <script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script>
    <script>
        var OneSignal = window.OneSignal || [];
        OneSignal.push(function() {
            OneSignal.init({
                appId: "xxx-xxx-xxx-xxxx-xxxxx",
            });
        });
    </script>

PHP Json ile Cihaz Ekleme:

<?PHP
$fields = array(
    'app_id' => "xxx-xxx-xxx-xxxx-xxxxx",
    'identifier' => "0000000000000000000000000000000000000000000000000000000000001002",
    'language' => "en",
    'timezone' => "-28800",
    'game_version' => "1.0",
    'device_os' => "9.1.3",
    'device_type' => "0",
    'device_model' => "iPhone 9,2",
    'tags' => array("abc" => "otel")
);

$fields = json_encode($fields);
print("\nJSON sent:\n");
print($fields);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/players");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
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["allresponses"] = $response;
$return = json_encode( $return);

print("\n\nJSON received:\n");
print($return);
print("\n");

?>