PHP code example of melipayamak / php

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

    

melipayamak / php example snippets


composer 

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();
}

// وب سرویس پیامک
$smsRest = $api->sms();
$smsSoap = $api->sms('soap');
// وب سرویس تیکت پشتیبانی
$ticket = $api->ticket();
// وب سرویس برای مدیریت کامل  ارسال انبوه پیامک
$branch = $api->branch();
//وب سرویس کاربران
$users = $api->users();
//وب سرویس دفترچه تلفن
$contacts = $api->contacts()


// وب سرویس پیامک
$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');

$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);

$smsRest->isDelivered($recId);
$smsSoap->isDelivered($recId);

$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);

$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);

$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);

$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);

$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);

$users->addPayment($options);

$users->add($options);


$users->addComplete($options);

$users->addWithLocation($options);

$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();
json
"melipayamak/php": "1.0.0"