Created
August 9, 2020 13:16
-
-
Save msacar/94d5745a63fefb21c733dc400d933201 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
namespace Managar; | |
use GuzzleHttp\Client; | |
class TurkcellDriver | |
{ | |
protected static $userName = "mustafa"; | |
protected static $password = "acar"; | |
protected static $apiKey = "6kbfc68dh1ea6b1b09f482828a2b1a33"; | |
protected static $originatorId = 2323; | |
protected static $token; | |
public function __construct() | |
{ | |
self::$token = self::createToken(); | |
} | |
public function createToken() | |
{ | |
//requests atıp oturum işlemini yapar ve tokeni kaydeder. | |
} | |
public function sendSms($phone, $text) | |
{ | |
$client = new Client(); | |
$request = $client->request( | |
"GET", | |
"https://api.turkcell.com/send-sms", | |
[ | |
'query' => [ | |
'token' => self::$token, | |
'originatorId' => self::$originatorId, | |
'ValidityPeriod' => "3", | |
'phoneNumber' => "$phone", | |
'messageText' => "$text", | |
] | |
] | |
); | |
return $data = $request->getBody()->getContents(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment