Message-ID: <1301778564.521.1403502674254.JavaMail.confluence@centos6.5-prod> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_520_921960867.1403502674252" ------=_Part_520_921960867.1403502674252 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html PHP

PHP

RegisterDevice

 

=20
<?php
$url =3D "https://ws.pushapps.mobi/RemoteAPI/RegisterDevice";
                $data =3D array(
                      'SecretToken'      =3D> 'XXXXXXXXXXX', ## Your app=
 secret token
                      'PushToken'    =3D> 'XXXXXXXXXXX', ## Device push =
token
                      'DeviceId'       =3D> 'XXXXXXXXXXX', ## Device uni=
que id
                      'DeviceType' =3D> 2, ## Device type - 1 for Androi=
d or 2 for iOS
                      'OSVersion'      =3D> '6.1.4', ## Optional, device=
 OS version
                      'DeviceDescription' =3D> 'iPhone5', ## Optional, d=
evice description
                      'AppVersion' =3D> '1.0', ## Optional, app version
                );
=20
        $content =3D json_encode($data);
=20
        $curl =3D curl_init($url);
        curl_setopt($curl, CURLOPT_HEADER, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HTTPHEADER,
                array("Content-type: application/json"));
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
=20
        $json_response =3D curl_exec($curl);
=20
        $status =3D curl_getinfo($curl, CURLINFO_HTTP_CODE);
=20
        if ( $status !=3D 200 ) {
            die("Error: call to URL $url failed with status $status, r=
esponse $json_response, curl_error " . curl_error($curl) . ", cur=
l_errno " . curl_errno($curl));
        }
=20
        curl_close($curl);
=20
                echo "Response: " . $json_response . "\n&quo=
t;;
        ?>
=20

 

UnregisterDevice

 

=20
<?php
    $url =3D "https://ws.pushapps.mobi/RemoteAPI/UnregisterDevice"=
;;
    $data =3D array(
                  'SecretToken'      =3D> 'XXXXXXXX', ## Your app secret=
 token
                  'DeviceId'       =3D> 'XXXXXXXX' ## Device id to unreg=
ister from app
                  );
    =20
    $content =3D json_encode($data);
    =20
    $curl =3D curl_init($url);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER,
                array("Content-type: application/json"));
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
    =20
    $json_response =3D curl_exec($curl);
    =20
    $status =3D curl_getinfo($curl, CURLINFO_HTTP_CODE);
    =20
    if ( $status !=3D 200 ) {
        die("Error: call to URL $url failed with status $status, respo=
nse $json_response, curl_error " . curl_error($curl) . ", curl_er=
rno " . curl_errno($curl));
    }
    =20
    curl_close($curl);
    =20
    echo "Response: " . $json_response . "\n";
        ?>
=20

 

CreateNotification

 

=20
<?php
    $url =3D "https://ws.pushapps.mobi/RemoteAPI/CreateNotification&qu=
ot;;
    $data =3D array(
                  'SecretToken'      =3D> 'XXXXXXXXXX', ## Your app secr=
et token
                  'Message' =3D> 'This is the content of the message', #=
# The message you want to send
                  'Platforms' =3D> array(1, 2), ## Optional, platforms t=
o send to, if empty will send to all configured platforms, will be overridd=
en if Devices is        specified
                  'Devices' =3D> array(array(
                                           'PushToken' =3D> 'XXXXXXXX', =
## Device push token
                                           'DeviceType' =3D> 2
                                           )) ## Optional, array of devices=
 to send, if empty will send to all registered users, or by Platforms if sp=
ecified
                  );
    =20
    $content =3D json_encode($data);
    =20
    $curl =3D curl_init($url);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER,
                array("Content-type: application/json"));
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
    =20
    $json_response =3D curl_exec($curl);
    =20
    $status =3D curl_getinfo($curl, CURLINFO_HTTP_CODE);
    =20
    if ( $status !=3D 200 ) {
        die("Error: call to URL $url failed with status $status, respo=
nse $json_response, curl_error " . curl_error($curl) . ", curl_er=
rno " . curl_errno($curl));
    }
    =20
    curl_close($curl);
    =20
    echo "Response: " . $json_response . "\n";
        ?>
=20

GetDevices

=20
<?php
$url =3D "https://ws.pushapps.mobi/RemoteAPI/GetDevices";
                $data =3D array(
                      'SecretToken'      =3D> '########################'=
, ## Your app secret token
                      'Amount'    =3D> 100, ## amount of devices to retr=
ieve
                      'Index'       =3D> 1, ## index to start from, 1 ba=
sed, so you can use this request with paging
                      'Platforms' =3D> array(1, 2), ## Optional, if left=
 empty then there is no filtering by platforms
                );
 =20
        $content =3D json_encode($data);
 =20
        $curl =3D curl_init($url);
        curl_setopt($curl, CURLOPT_HEADER, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HTTPHEADER,
                array("Content-type: application/json"));
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
 =20
        $json_response =3D curl_exec($curl);
 =20
        $status =3D curl_getinfo($curl, CURLINFO_HTTP_CODE);
 =20
        if ( $status !=3D 200 ) {
            die("Error: call to URL $url failed with status $status, r=
esponse $json_response, curl_error " . curl_error($curl) . ", cur=
l_errno " . curl_errno($curl));
        }
 =20
        curl_close($curl);
 =20
                echo "Response: " . $json_response . "\n&quo=
t;;
        ?> 
=20

------=_Part_520_921960867.1403502674252--