PHP code example of ghasedak / php

1. Go to this page and download the library: Download ghasedak/php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ghasedak / php example snippets

  
  
$api = new \Ghasedak\GhasedakApi( 'your_api_key');  
  
$api->SendSimple(  
 "09xxxxxxxxx", // receptor
 "Hello World!", // message
 "3000xxxxx" // choose a line number from your account
);  
  

try{  
 $message = "Hello, World!";
 $lineNumber = null; // If you do not have a dedicated line, you must specify the line number  
 $receptor = "09xxxxxxxxx";
 $api = new \Ghasedak\GhasedakApi('api_key');
 $api->SendSimple($receptor,$message,$lineNumber);  
}
catch(\Ghasedak\Exceptions\ApiException $e){  
 echo $e->errorMessage();  
}  
catch(\Ghasedak\Exceptions\HttpException $e){  
 echo $e->errorMessage();  
}  
  
$api->setVerifyType(GhasedakApi::VERIFY_TEXT_TYPE)->Verify(  
 "09xxxxxxxxx",  // receptor
 "my-template",  // name of the template which you've created in you account 
 "param1",       // parameters (supporting up to 10 parameters) 
 "param2", 
 "param3");
 
  
try{  
 $receptor = "09xxxxxxxxx";
 $type = 1;
 $template = "my-template";
 $param1 = '123456';
 $api = new \Ghasedak\GhasedakApi('api_key');
 $api->Verify($receptor, $type, $template, $param1);
}  
catch(\Ghasedak\Exceptions\ApiException $e){  
 echo $e->errorMessage();  
}  
catch(\Ghasedak\Exceptions\HttpException $e){  
 echo $e->errorMessage();  
}  
  
  
$api = new \Ghasedak\GhasedakApi( 'your_api_key');  
  
$api->SendSimple(  
	"09xxxxxxxxx",  // receptor 
	"Hello World!", // message 
	"3000xxxxx" 	// choose a line number from your account
 );
  
ry{  
 $message = "Hello, World!";
 $lineNumber = null; // If you do not have a dedicated line, you must specify the line number  
 $receptor = "09xxxxxxxxx";
 $api = new \Ghasedak\GhasedakApi('api_key');
 $api->SendSimple($receptor,$message,$lineNumber);  
}  
catch(\Ghasedak\Exceptions\ApiException $e){  
 echo $e->errorMessage();  
}  
catch(\Ghasedak\Exceptions\HttpException $e){  
 echo $e->errorMessage();  
}  
  
$api->setVerifyType(GhasedakApi::VERIFY_TEXT_TYPE)->Verify( 
 "09xxxxxxxxx", // receptor 
 "my-template", // name of the template which you've created in you account 
 "param1",      // parameters (supporting up to 10 parameters) 
 "param2", 
 "param3");
 
  
ry{  
 $receptor = "09xxxxxxxxx";
 $type = 1;
 $template = "my-template";
 $param1 = '123456';
 $api = new \Ghasedak\GhasedakApi('api_key');
 $api->Verify($receptor, $type, $template, $param1);  
}  
catch(\Ghasedak\Exceptions\ApiException $e){  
 echo $e->errorMessage();  
}  
catch(\Ghasedak\Exceptions\HttpException $e){  
 echo $e->errorMessage();  
}