PHP code example of hivelink / php

1. Go to this page and download the library: Download hivelink/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/ */

    

hivelink / php example snippets

  
  
$api = new \Hivelink\HivelinkApi( 'your_api_key');  
  
$api->SendSimple(  
 "09xxxxxxxxx", // receiver
 "9000xxxxx", // choose a line number from your account
 "This is a test!Hivelink", // message
);  
  

try{  
 $message = "This is a test!Hivelink";
 $lineNumber = null; // If you do not enter the line number, the message will be sent from the fastest HiveLink service line
 $receiver = "091xxxxxxxx"; // Use this method if sending to a mobile number
 $receiver = array("091********","092********"); // Use this method if sending to multiple mobile numbers
 $api = new \HiveLinkLib\HivelinkApi('api_key_developer');
 $api->SendSimple($lineNumber,$receiver,$message);  
}
catch(\HiveLinkLib\Exceptions\ApiException $e){  
 //If the response to the request is unsuccessful, this section will work
 echo $e->errorMessage();  
}  
catch(\HiveLinkLib\Exceptions\HttpException $e){  
 //If there is a problem in communicating with the HiveLink web service, this section will work
 echo $e->errorMessage();  
}  
  
  
$api = new \Hivelink\HivelinkApi('your_api_key');  
  
$api->SendSimple(  
 "09xxxxxxxxx", // گیرنده پیام
 "9000xxxxx", // انتخاب خط ارسال کننده پیام ، در صورت وارد نکردن از خط با سرعت بالا استفاده میشود!
 "This is a test!Hivelink", // message
); 
  
ry{  
 $message = "این یک تست می باشد!هایولینک";
 $lineNumber = null; // اگر شماره خط را وارد نکنید، پیام از سریعترین خط سرویس هایولینک ارسال می شود
 $receiver = "091xxxxxxxx";
 $api = new \Hivelink\HivelinkApi('کلید توسعه دهنده');
 $api->SendSimple($lineNumber,&receiver,$message);  
}  
catch(\Hivelink\Exceptions\ApiException $e){ 
 //اگر پاسخ به درخواست ناموفق باشد، این بخش کار خواهد کرد
 echo $e->errorMessage();  
}  
catch(\Hivelink\Exceptions\HttpException $e){  
//در صورت بروز مشکل در برقراری ارتباط با وب سرویس هایولینک ، این قسمت کار می کند
 echo $e->errorMessage();  
}