PHP code example of myvon / devicechanger

1. Go to this page and download the library: Download myvon/devicechanger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

myvon / devicechanger example snippets


use Myvon\DeviceChanger\DummyGenerator;


$generator = new \Myvon\DeviceChanger\DummyGenerator("http://localhost/upload.php");

use Myvon\DeviceChanger\DummyGenerator;


$generator = new \Myvon\DeviceChanger\BitlyUrlGenerator("http://localhost/upload.php", "myBitlyAccessToken");

$sender = new \Myvon\DeviceChanger\OvhSmsSender($ovhApi, "MY COMPANY", "sms-xxxxxx-1");

$storage = new \Myvon\DeviceChanger\FileStorage('./upload');

$deviceChanger = new \Myvon\DeviceChanger\DeviceChanger(
    $generator,
    $sender,
    $storage,
    "Pour continuer, veuillez vous rendre à l'adresse %url% (envoyé à %phone%)"
);

if(($uid = $deviceChanger->send("+33600000000"))) {
    // Success
}

$uid = $deviceChanger->send("+33600000000", [
'myparameter' => 'my value',
]); // %myparameter% will be replace by 'my value'


if($deviceChanger->check($uid)) {
    // Data have been received
}

$data  = $devicechanger->fetch($uid); // Return false if data not received