-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
37 changed files
with
2,410 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace Pamenary\LaravelSms\Gateways; | ||
|
||
/** | ||
* Created by PhpStorm. | ||
* User: Ali | ||
* Date: 12/23/2016 | ||
* Time: 12:51 PM | ||
*/ | ||
class AdpdigitalGateway extends GatewayAbstract { | ||
|
||
/** | ||
* AdpdigitalGateway constructor. | ||
*/ | ||
public function __construct() { | ||
|
||
$this->webService = config('sms.gateway.adpdigital.webService'); | ||
$this->username = config('sms.gateway.adpdigital.username'); | ||
$this->password = config('sms.gateway.adpdigital.password'); | ||
$this->from = config('sms.gateway.adpdigital.from'); | ||
} | ||
|
||
|
||
/** | ||
* @param array $numbers | ||
* @param $text | ||
* @param bool $isflash | ||
* | ||
* @return mixed | ||
* @internal param $to | array | ||
*/ | ||
public function sendSMS( array $numbers, $text, $isflash = false ) { | ||
// Check credit for the gateway | ||
if(!$this->GetCredit()) return; | ||
|
||
$to = str_replace("09", "989", implode($numbers, ",")); | ||
$msg = urlencode($text); | ||
|
||
$result = file_get_contents("{$this->webService}send?username={$this->username}&password={$this->password}&dstaddress={$to}&body={$msg}&clientid={$this->from}&type=text&unicode=1"); | ||
|
||
return $result->Code; | ||
} | ||
|
||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getCredit() { | ||
$result = file_get_contents("{$this->webService}balance?username={$this->username}&password={$this->password}&facility=send"); | ||
|
||
if( strstr($result, 'ERR') ) { | ||
return 0; | ||
} else { | ||
return preg_replace('/[^0-9]/', '', $result); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
namespace Pamenary\LaravelSms\Gateways; | ||
|
||
/** | ||
* Created by PhpStorm. | ||
* User: Ali | ||
* Date: 12/23/2016 | ||
* Time: 12:51 PM | ||
*/ | ||
class AfeGateway extends GatewayAbstract { | ||
|
||
/** | ||
* AfeGateway constructor. | ||
*/ | ||
public function __construct() { | ||
|
||
$this->webService = config('sms.gateway.afe.webService'); | ||
$this->username = config('sms.gateway.afe.username'); | ||
$this->password = config('sms.gateway.afe.password'); | ||
$this->from = config('sms.gateway.afe.from'); | ||
} | ||
|
||
|
||
/** | ||
* @param array $numbers | ||
* @param $text | ||
* @param bool $isflash | ||
* | ||
* @return mixed | ||
* @internal param $to | array | ||
*/ | ||
public function sendSMS( array $numbers, $text, $isflash = false ) { | ||
try { | ||
// Check credit for the gateway | ||
if ( ! $this->GetCredit() ) { | ||
return false; | ||
} | ||
$client = new \SoapClient('http://www.afe.ir/WebService/V4/BoxService.asmx?WSDL'); | ||
if($isflash) { | ||
$type = 0; | ||
} else { | ||
$type = 1; | ||
} | ||
|
||
$param = array( | ||
'Username' => $this->username, | ||
'Password' => $this->password, | ||
'Number' => $this->from, | ||
'Mobile' => $numbers, | ||
'Message' => $text, | ||
'Type' => $type | ||
); | ||
|
||
$result = $client->SendMessage($param); | ||
$result = $result->SendMessageResult->string; | ||
|
||
return $result; | ||
} catch( SoapFault $ex ) { | ||
echo $ex->faultstring; | ||
} | ||
} | ||
|
||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getCredit() { | ||
try { | ||
$client = new \SoapClient( $this->webService ); | ||
|
||
$result = $client->GetRemainingCredit( array('Username' => $this->username, 'Password' => $this->password) ); | ||
return $result->GetRemainingCreditResult; | ||
} catch( SoapFault $ex ) { | ||
echo $ex->faultstring; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace Pamenary\LaravelSms\Gateways; | ||
|
||
/** | ||
* Created by PhpStorm. | ||
* User: Ali | ||
* Date: 12/23/2016 | ||
* Time: 12:51 PM | ||
*/ | ||
class AfilnetGateway extends GatewayAbstract { | ||
|
||
/** | ||
* AfilnetGateway constructor. | ||
*/ | ||
public function __construct() { | ||
|
||
$this->webService = config('sms.gateway.afilnet.webService'); | ||
$this->username = config('sms.gateway.afilnet.username'); | ||
$this->password = config('sms.gateway.afilnet.password'); | ||
$this->from = config('sms.gateway.afilnet.from'); | ||
} | ||
|
||
|
||
/** | ||
* @param array $numbers | ||
* @param $text | ||
* @param bool $isflash | ||
* | ||
* @return mixed | ||
* @internal param $to | array | ||
*/ | ||
public function sendSMS( array $numbers, $text, $isflash = false ) { | ||
try { | ||
// Check credit for the gateway | ||
if ( ! $this->GetCredit() ) { | ||
return false; | ||
} | ||
$client = new \SoapClient( $this->webService ); | ||
$result = $client->SendSMSPlusArray($this->username, $this->password, $this->from, '34', $numbers, $text, 1, 0); | ||
|
||
return $result; | ||
} catch( SoapFault $ex ) { | ||
echo $ex->faultstring; | ||
} | ||
} | ||
|
||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getCredit() { | ||
if(!$this->username and !$this->password) | ||
return false; | ||
try { | ||
$result = $client->Credits($this->username, $this->password); | ||
return $result; | ||
} catch( SoapFault $ex ) { | ||
echo $ex->faultstring; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
namespace Pamenary\LaravelSms\Gateways; | ||
|
||
/** | ||
* Created by PhpStorm. | ||
* User: Ali | ||
* Date: 12/23/2016 | ||
* Time: 12:51 PM | ||
*/ | ||
class AmansoftGateway extends GatewayAbstract { | ||
|
||
/** | ||
* AmansoftGateway constructor. | ||
*/ | ||
public function __construct() { | ||
|
||
$this->webService = config('sms.gateway.amansoft.webService'); | ||
$this->username = config('sms.gateway.amansoft.username'); | ||
$this->password = config('sms.gateway.amansoft.password'); | ||
$this->from = config('sms.gateway.amansoft.from'); | ||
} | ||
|
||
|
||
/** | ||
* @param array $numbers | ||
* @param $text | ||
* @param bool $isflash | ||
* | ||
* @return mixed | ||
* @internal param $to | array | ||
*/ | ||
public function sendSMS( array $numbers, $text, $isflash = false ) { | ||
try { | ||
// Check credit for the gateway | ||
if ( ! $this->GetCredit() ) { | ||
return false; | ||
} | ||
$client = new \SoapClient( $this->webService ); | ||
$result = $client->SendSms( | ||
array( | ||
'username' => $this->username, | ||
'password' => $this->password, | ||
'from' => $this->from, | ||
'to' => $numbers, | ||
'text' => $text, | ||
'flash' => $isflash, | ||
'udh' => '' | ||
) | ||
); | ||
|
||
return $result; | ||
} catch( SoapFault $ex ) { | ||
echo $ex->faultstring; | ||
} | ||
} | ||
|
||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getCredit() { | ||
if(!$this->username and !$this->password) | ||
return 'Blank Username && Password'; | ||
try { | ||
$client = new \SoapClient( $this->webService ); | ||
|
||
$result = $client->Credit(array('username' => $this->username, 'password' => $this->password)); | ||
|
||
return $result->CreditResult; | ||
} catch( SoapFault $ex ) { | ||
echo $ex->faultstring; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.