Skip to content

Instantly share code, notes, and snippets.

@msacar
Created August 9, 2020 13:17
Show Gist options
  • Save msacar/45930281835ab3041c3e6fe37d1ce0c2 to your computer and use it in GitHub Desktop.
Save msacar/45930281835ab3041c3e6fe37d1ce0c2 to your computer and use it in GitHub Desktop.
<?php
namespace Managar;
use GuzzleHttp\Client;
class VodafoneDriver
{
protected static $userName = "mustafa";
protected static $password = "acar";
protected static $apiKey = "a68ef29e68bd84e8de4021cbac523f";
protected static $vendor = "5";
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.vodafone.com/send-sms",
[
'query' => [
'token' => self::$token,
'vendor' => self::$vendor,
'phone' => "$phone",
'text' => "$text",
'apiKey' => self::$apiKey
]
]
);
return $data = $request->getBody()->getContents();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment