File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use MessageBird \Client ;
4+ use MessageBird \Exceptions \AuthenticateException ;
5+ use MessageBird \Exceptions \BalanceException ;
6+ use MessageBird \Objects \Verify ;
7+
8+ require_once (__DIR__ . '/../autoload.php ' );
9+
10+ $ messageBird = new Client ('YOUR_ACCESS_KEY ' ); // Set your own API access key here.
11+
12+ $ verify = new Verify ();
13+ $ verify ->recipient = 'Client Name <client-email@example.com> ' ;
14+
15+ $ extraOptions = [
16+ 'type ' => 'email ' ,
17+ 'originator ' => 'Email Verification <verify@company.com> ' ,
18+ 'timeout ' => 60 ,
19+ ];
20+
21+ try {
22+ $ verifyResult = $ messageBird ->verify ->create ($ verify , $ extraOptions );
23+ var_dump ($ verifyResult );
24+ } catch (AuthenticateException $ e ) {
25+ // That means that your accessKey is unknown
26+ echo 'wrong login ' ;
27+ } catch (BalanceException $ e ) {
28+ // That means that you are out of credits, so do something about it.
29+ echo 'no balance ' ;
30+ } catch (\Exception $ e ) {
31+ echo $ e ->getMessage ();
32+ }
You can’t perform that action at this time.
0 commit comments