Skip to content

Commit

Permalink
Add try/catch in example
Browse files Browse the repository at this point in the history
  • Loading branch information
amirbagh75 committed Nov 21, 2020
1 parent 1e4f3eb commit 831f04d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ composer require amirbagh75/smsir-php
```php
<?php

require_once '../vendor/autoload.php';
require_once __DIR__ . '/../vendor/autoload.php';

use Amirbagh75\SMSIR\SmsIRClient;

Expand All @@ -21,7 +21,12 @@ $secretKey = getenv('SECRET_KEY');
$lineNumber = getenv('LINE_NUMBER');

$smsir = new SmsIRClient($apiKey, $secretKey, $lineNumber);
print_r($smsir->smsCredit());
try {
$res = $smsir->getSentMessages('1399/06/01', '1399/10/01', 1, 250);
print_r($res);
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
error_log($e->getMessage(), 0);
}
```

### Current methods:
Expand Down
8 changes: 6 additions & 2 deletions examples/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
$lineNumber = getenv('LINE_NUMBER');

$smsir = new SmsIRClient($apiKey, $secretKey, $lineNumber);
$res = $smsir->getSMSLines();
try {
$res = $smsir->getSentMessages('1399/06/01', '1399/10/01', 1, 250);
print_r($res);
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
error_log($e->getMessage(), 0);
}

print_r($res->isSuccessful);

0 comments on commit 831f04d

Please sign in to comment.