HiveLink Operator Library for PHP!

v1.0.4 2023-11-07 22:35 UTC

This package is not auto-updated.

Last update: 2024-09-25 02:04:20 UTC


README

Logo

HiveLink Library Php

实现Hivelink SMS API的PHP项目的易于使用的SDK。
探索文档»


英文文档 | 波斯语文档

目录

安装

最简单的安装方式是使用 Composer

composer require hivelink/php  

Composer 是一个PHP依赖管理器,允许您声明项目依赖的库,并且它会为您管理(安装/更新)它们。如果您不熟悉Composer,您可以阅读其文档并通过 getcomposer.org 下载它。

或者您可以从 这里 下载HiveLink SDK,将其解压缩到您的项目中,并按照以下步骤继续操作。此外,包内还有一个 示例 文件夹,您可以使用它来了解流程。

使用方法

要使用API,您需要一个API密钥。要获取它,您应该有一个 Hivelink 账户。注册并获取您的API密钥。

然后需要包含文件 autoload.php 以加载所有类和依赖。

require __DIR__ . '/vendor/autoload.php';

使用您的API密钥从 Hivelink 类创建一个实例

$api = new \Hivelink\HivelinkApi( 'your_api_key');  

别忘了将 your_api_key 替换为您从 Hivelink 账户获得的密钥。

发送短信

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

参数

示例

以下是发送短信的示例代码。请注意,如果您正在寻找特定的行,您必须指定 行号

require __DIR__ . '/vendor/autoload.php';
 
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();  
}  

许可证

MIT 许可证的条款下自由分发。

目录

安装

最简单的安装方式是使用 Composer

composer require hivelink/php

使用方法

要使用此软件包,您需要一个API密钥。您需要在 Hivelink 系统中 注册并从您的用户面板获取API密钥。

然后您需要将 autoload 文件添加到您的项目中

require __DIR__ . '/vendor/autoload.php';

使用您的API密钥创建一个 Hivelink 类的实例

$api = new \Hivelink\HivelinkApi('your_api_key');  

请记住,将 your_api_key 替换为您从 Hivelink 账户获得的密钥。

发送您的短信

$api->SendSimple(  
 "09xxxxxxxxx", // گیرنده پیام
 "9000xxxxx", // انتخاب خط ارسال کننده پیام ، در صورت وارد نکردن از خط با سرعت بالا استفاده میشود!
 "This is a test!Hivelink", // message
); 

参数

示例代码

以下是一个发送短信的示例代码。请注意,如果您正在寻找特定的行,您必须指定 "行号"。

require __DIR__ . '/vendor/autoload.php';  
try{  
 $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();  
}