melipayamak / php
melipayamak的Web服务的PHP包装器
1.0.0
2019-12-23 13:19 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-09-24 12:39:10 UTC
README
介绍melipayamak的Web服务
melipayamak是一个完整的Web服务,用于发送和接收短信和语音短信,以及全面管理其他服务,您可以轻松使用。
安装
在安装之前,您需要注册melipayamak网站。
注册后,您可以通过以下方式安装:
composer require melipayamak/php:1.0.0
或者通过将以下行添加到composer.json文件中
"melipayamak/php": "1.0.0"
然后执行命令
composer update
用法
发送短信的示例代码
require __DIR__ . '/vendor/autoload.php'; use Melipayamak\MelipayamakApi; try{ $username = 'username'; $password = 'password'; $api = new MelipayamakApi($username,$password); $sms = $api->sms(); $to = '09123456789'; $from = '5000...'; $text = 'تست وب سرویس ملی پیامک'; $response = $sms->send($to,$from,$text); $json = json_decode($response); echo $json->Value; //RecId or Error Number }catch(Exception $e){ echo $e->getMessage(); }
由于melipayamak的Web服务不仅限于发送短信,您可以通过以下方式完全访问Web服务
// وب سرویس پیامک $smsRest = $api->sms(); $smsSoap = $api->sms('soap'); // وب سرویس تیکت پشتیبانی $ticket = $api->ticket(); // وب سرویس برای مدیریت کامل ارسال انبوه پیامک $branch = $api->branch(); //وب سرویس کاربران $users = $api->users(); //وب سرویس دفترچه تلفن $contacts = $api->contacts()
异步模式
您还可以在异步模式下使用melipayamak的Web服务。以下是如何在PHP中准备异步的示例。请注意,异步命令在调用execute
方法(并行)时执行。
// وب سرویس پیامک $smsRestAsync = $api->sms('async'); $smsSoapAsync = $api->sms('soap', 'async'); // وب سرویس تیکت پشتیبانی $ticket = $api->ticket('async'); // وب سرویس برای مدیریت کامل ارسال انبوه پیامک $branch = $api->branch('async'); //وب سرویس کاربران $users = $api->users('async'); //وب سرویس دفترچه تلفن $contacts = $api->contacts('async');
rest和soap Web服务的区别
由于melipayamak为开发人员提供了完整的Web服务,为了方便与短信Web服务交互,除了主要的soap Web服务外,还向开发人员提供了rest Web服务,以便他们可以更轻松地与Web服务交互。这两种服务的主要区别在于您可以使用的方法的数量。对于基本工作,您可以使用rest Web服务,而对于更高级的访问和使用,您应该使用soap Web服务。有关Web服务的更多信息,请参阅您的Web服务面板。
更多信息
有关更多信息,以及了解Web服务的输入和输出参数,请访问melipayamak Web服务介绍页面。
短信Web服务
Web服务方法
发送
$smsRest->send($to,$from,$text,$isFlash); $smsSoap->send($to,$from,$text,$isFlash);
添加特殊黑名单
$smsSoap->addblacklist($title);
添加模式或模板
$smsSoap->sharedServiceBodyAdd($title,$body,$blackListId);
查看已添加的模式
$smsSoap->getSharedServiceBody();
通过模板发送(共享服务热线)
$smsRest->sendByBaseNumber($text,$to,$bodyId); $smsSoap->sendByBaseNumber($text,$to,$bodyId);
- 在soap Web服务中,发送一个数字数组而不是单个数字也是可接受的
接收发送状态
$smsRest->isDelivered($recId); $smsSoap->isDelivered($recId);
- 在soap Web服务中,可以使用数组而不是单个ID发送。
短信列表
$smsRest->getMessages($location,$index,$count,$from); $smsSoap->getMessages($location,$index,$count,$from); $smsSoap->getMessagesStr($location,$index,$count,$from); // جهت دریافت به صورت رشته ای $smsSoap->getMessagesByDate($location,$index,$count,$from,$dateFrom,$dateTo); //جهت دریافت بر اساس تاریخ $smsSoap->getUsersMessagesByDate($location,$index,$count,$from,$dateFrom,$dateTo); // جهت دریافت پیام های کاربران بر اساس تاریخ
库存
$smsRest->getCredit(); $smsSoap->getCredit();
基本费率/发送前获取价格
$smsRest->getBasePrice(); $smsSoap->getPrice($irancellCount,$mtnCount,$from,$text);
特殊号码列表
$smsRest->getNumbers();
检查接收到的短信数量
$smsSoap->getInboxCount($isRead); //پیش فرض خوانده نشده
发送高级短信
$smsSoap->send2($to,$from,$text,$isflash,$udh);
查看短信详情
$smsSoap->getMessagesReceptions($msgId,$fromRows);
删除接收的短信
$smsSoap->remove($msgIds);
定时发送
$smsSoap->sendSchedule($to,$from,$text,$isflash,$scheduleDateTime,$period);
对应定时发送
$smsSoap->sendMultipleSchedule($to,$from,$text,$isflash,$scheduleDateTime,$period);
定时发送
$smsSoap->addUsance($to,$from,$text,$isflash,$scheduleStartDateTime,$repeatAfterDays,$scheduleEndDateTime);
查看定时发送状态
$smsSoap->getScheduleStatus($schId);
删除定时短信
$smsSoap->removeSchedule($schId);
语音短信Web服务
发送带语音的短信
$smsSoap->sendWithSpeech($to,$from,$text,$speech);
定时发送带语音的短信
$smsSoap->sendWithSpeechSchduleDate($to,$from,$text,$speech,$scheduleDate);
接收带语音的短信状态
$smsSoap->getSendWithSpeech($recId);
定时大批量呼叫
$smsSoap->SendBulkSpeechText($title, $body, $receivers, $DateToSend, $repeatCount);
通过选择文件定时大批量呼叫
$smsSoap->SendBulkVoiceSMS($title, $voiceFileId, $receivers, $DateToSend, $repeatCount);
上传音频文件
$smsSoap->UploadVoiceFile($title, $base64StringFile);
大批量/区域发送Web服务
接收银行分支标识符
$branch->get($owner);
添加新的银行
$branch->add($branchName,$owner);
添加号码到银行
$branch->addNumber($mobileNumbers,$branchId);
删除银行
$branch->remove($branchId);
通过银行发送大批量
$branch->sendBulk($from,$title,$message,$branch,$DateToSend,$requestCount,$bulkType,$rowFrom,$rangeFrom,$rangeTo); $branch->sendBulk2($from,$title,$message,$branch,$DateToSend,$requestCount,$bulkType,$rowFrom,$rangeFrom,$rangeTo);
现有号码数量
$branch->getBulkCount($branch,$rangeFrom,$rangeTo);
大批量发送报告
$branch->getBulkReceptions($bulkId,$fromRows);
设置发送状态
$branch->getBulkStatus($bulkId);
今天的发送次数
$branch->getTodaySent();
总发送次数
$branch->getTotalSent();
删除区域发送
$branch->removeBulk($id);
对应发送
$branch->sendMultipleSms($to,$from,$text,$isflash,$udh);
报告状态显示
$branch->updateBulkDelivery($bulkId);
票务Web服务
注册新票务
$ticket->add($title,$content,$aletWithSms);
搜索和获取票务
$ticket->getReceived($ticketOwner,$ticketType,$keyword);
获取用户票务数量
$ticket->getReceivedCount($ticketType);
获取已发送的票务
$ticket->getSent($ticketOwner,$ticketType,$keyword);
获取已发送的票务数量
$ticket->getSentCount($ticketType);
回复票务
$ticket->response($ticketId,$type,$content,$alertWithSms);
电话簿Web服务
添加新组
$contacts->addGroup($groupName,$Descriptions,$showToChilds);
添加新用户
$contacts->add($options);
检查电话簿中号码的存在性
$contacts->checkMobileExist($mobileNumber);
获取电话簿信息
$contacts->get($groupId,$keyword,$from,$count);
获取组别
$contacts->getGroups();
编辑联系人
$contacts->change($options);
删除联系人
$contacts->remove($mobilenumber);
获取个人事件信息
$contacts->getEvents($contactId);
用户Web服务
登记付款收据
$users->addPayment($options);
在系统中添加新用户
$users->add($options);
在系统中添加新用户(完整版)
$users->addComplete($options);
在系统中添加新用户(带位置)
$users->addWithLocation($options);
获取用户ID
$users->authenticate();
更改有效期
$users->changeCredit($amount,$description,$targetUsername,$GetTax);
忘记密码
$users->forgotPassword($mobileNumber,$emailAddress,$targetUsername);
获取用户基本费用
$users->getBasePrice($targetUsername);
获取用户有效期
$users->getCredit($targetUsername);
获取用户信息
$users->getDetails($targetUsername);
获取用户号码
$users->getNumbers();
获取用户交易
$users->getTransactions($targetUsername,$creditType,$dateFrom,$dateTo,$keyword);
获取用户信息
$users->get();
获取过滤信息
$users->hasFilter($text);
删除用户
$users->remove($targetUsername);
查看省份
$users->getProvinces();
查看县级代码
$users->getCities($provinceId);
查看用户过期日期
$users->getExpireDate();