Skip to content

Instantly share code, notes, and snippets.

@msacar
Created August 9, 2020 13:16
Show Gist options
  • Save msacar/94d5745a63fefb21c733dc400d933201 to your computer and use it in GitHub Desktop.
Save msacar/94d5745a63fefb21c733dc400d933201 to your computer and use it in GitHub Desktop.
<?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