Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
pamenary authored Dec 29, 2016
1 parent 9f67c60 commit 06ca335
Showing 37 changed files with 2,410 additions and 63 deletions.
59 changes: 59 additions & 0 deletions src/Gateways/AdpdigitalGateway.php
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);
}
}

}
79 changes: 79 additions & 0 deletions src/Gateways/AfeGateway.php
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;
}
}

}
63 changes: 63 additions & 0 deletions src/Gateways/AfilnetGateway.php
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;
}
}

}
76 changes: 76 additions & 0 deletions src/Gateways/AmansoftGateway.php
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;
}
}

}
63 changes: 53 additions & 10 deletions src/Gateways/AradsmsGateway.php
Original file line number Diff line number Diff line change
@@ -2,30 +2,73 @@
/**
* Created by PhpStorm.
* User: Ali
* Date: 12/23/2016
* Time: 5:51 PM
* Date: 12/24/2016
* Time: 7:14 PM
*/

namespace Pamenary\LaravelSms\Gateways;


class AradsmsGateway implements GatewayInterface{
class AradsmsGateway extends GatewayAbstract {
/**
* @param $to
* @param $text
* @param bool $isflash
* AradsmsGateway constructor.
*/
public function __construct() {
$this->webService = config( 'sms.gateway.azinweb.webService' );
$this->username = config( 'sms.gateway.azinweb.username' );
$this->password = config( 'sms.gateway.azinweb.password' );
$this->from = config( 'sms.gateway.azinweb.from' );
}


/**
* @param array $numbers
* @param $text
* @param bool $isflash
*
* @return mixed
* @return bool
*/
public function sendSMS( $to, $text, $isflash = false ) {
// TODO: Implement sendSMS() method.
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(
[
'username' => $this->username,
'password' => $this->password,
'from' => $this->from,
'to' => $numbers,
'text' => $text,
'isflash' => $isflash,
'udh' => '',
'recId' => [ 0 ],
'status' => 0x0,
]
);

return $result->SendSmsResult;
} catch( SoapFault $ex ) {
echo $ex->faultstring;
}
}

/**
* @return mixed
*/
public function getCredit() {
// TODO: Implement getCredit() method.
try {
$client = new \SoapClient( $this->webService );

return $client->GetCredit( [
"username" => $this->username,
"password" => $this->password,
] )->GetCreditResult;
} catch( SoapFault $ex ) {
echo $ex->faultstring;
}
}

}
Loading
Oops, something went wrong.

0 comments on commit 06ca335

Please sign in to comment.