همه ی کوشش ما بر این بوده که وب سرویس سامانه کاربند پسند و ساده باشد. چنانچه شما اینگونه نمی اندیشید میتوانید دیدگاه خودتان را با ما در میان بگذارید.
از این پس شما میتوانید با rest و فرستادن درخواست post به آدرس http://otp.safironline.ir/customer/rest پیامک آوای خود را بفرستید.
هر پیامی که وب سرویس سامانه بر میگرداند در برگیرنده یک messageid هست. ما اینجا همه ی messageid ها را به همراه پیام آن به شما نشان میدهیم.
Array
(
[17] => شناسه کاربری و یا گذواژه نادرست است.
[502] => برای این id داده ای در دست نیست
)
فرستادن پیامک آوا
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'upload/add', array( 'files[]' => '@'.realpath('./test.wav') ), function( $data ) {
print_r( $data );
$uploadid = $data->id;
});
print_r( $res );
{"message":"\u0628\u0627\u0631\u06af\u0632\u0627\u0631\u06cc \u0628\u0627 \u067e\u06cc\u0631\u0648\u0632\u06cc \u0627\u0646\u062c\u0627\u0645 \u0634\u062f","status":1,"data":{"id":"769"}}
stdClass Object
(
[message] => بارگزاری با پیروزی انجام شد
[status] => 1
[data] => stdClass Object
(
[id] => 769
)
)
شاید شما برای فرستادن پیامک آوایتان شماره ویژه خودتان را داشته باشید و یا اینکه برای زمان های گوناگون نرخ های گوناگون داشته باشید و یا اینکه پیش از این پیوست هایی را بارگزاری کرده اید که دیگر نیاز به بارگزاری دوباره ندارد، این متد برای این موارد نیازین است. اگر چه، اگر شما دارای یک شماره و یک نرخ و یک پیوست باشید، در متد ارسال پیش انگار برای شما گزینش خواهد شد.
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
try {
$response = $client->__call("parsip.get_voice_feature", array( "09131111111", "123456" ) );
$result = json_decode( $response);
$feature = $result->data;
print_r( $feature );
} catch( SoapFault $e ) {
var_dump( $e );
}
<?php
$response = '{"message":"\u0646\u0645\u0627\u06cc\u0634 \u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u067e\u06cc\u0627\u0645\u06a9 \u0622\u0648\u0627","status":1,"data":{"loop_number":[{"id":"3","title":"4533322961"}],"loop_price":[{"id":"43","title":"\u06a9\u0627\u0631\u0628\u0631\u0627\u0646 \u067e\u0644\u06a9\u0627\u0646 \u0627\u0648\u0644","duration":"30","price_in":"410","price_out":"450","price_out_n":"520","price_fax":"300"},{"id":"48","title":"\u06a9\u0627\u0631\u0628\u0631\u0627\u0646 \u067e\u0644\u06a9\u0627\u0646 \u0627\u0648\u0644 20 \u062b\u0627\u0646\u06cc\u0647 \u0627\u06cc","duration":"20","price_in":"350","price_out":"380","price_out_n":"450","price_fax":"300"},{"id":"53","title":"\u06a9\u0627\u0631\u0628\u0631\u0627\u0646 \u06cc\u06a9 \u062f\u0642\u06cc\u0642\u0647 \u0627\u06cc","duration":"60","price_in":"580","price_out":"580","price_out_n":"650","price_fax":"300"}]}}';
$arr = json_decode( $response );
?>
stdClass Object
(
[message] => نمایش داده های پیامک آوا
[status] => 1
[data] => stdClass Object
(
[loop_number] => Array
(
[0] => stdClass Object
(
[id] => 3
[title] => 4533322961
)
)
[loop_price] => Array
(
[0] => stdClass Object
(
[id] => 43
[title] => کاربران پلکان اول
[duration] => 30
[price_in] => 410
[price_out] => 450
[price_out_n] => 520
[price_fax] => 300
)
[1] => stdClass Object
(
[id] => 48
[title] => کاربران پلکان اول 20 ثانیه ای
[duration] => 20
[price_in] => 350
[price_out] => 380
[price_out_n] => 450
[price_fax] => 300
)
[2] => stdClass Object
(
[id] => 53
[title] => کاربران یک دقیقه ای
[duration] => 60
[price_in] => 580
[price_out] => 580
[price_out_n] => 650
[price_fax] => 300
)
)
)
)
در زیر نمونه کد فرم فرستادن پیامک آوا را به شما نشان خواهم داد.
<meta charset="utf-8" />
<?php
ini_set("soap.wsdl_cache_enabled", "0");
$wsdl="http://otp.safironline.ir/webservice/ws.php?wsdl";
try {
$client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
try {
$response = $client->__call("parsip.get_voice_feature", array( "09131111111", "123456" ) );
$result = json_decode( $response);
$feature = $result->data;
} catch( SoapFault $e ) {
var_dump( $e );
}
echo '<form action="?send" method="post" enctype="multipart/form-data">
دیباچه : <input type="text" name="title" /> <br />
uniqid : <input type="text" name="uniqid" value="1" /> <br />
تلاش : <input type="text" name="try" value="1" /> <br />
بازه تلاش : <input type="text" name="try_interval" value="10" /> <br />
شماره ها : <textarea name="numbers" placeholder="شماره ها را با اینتر از هم جدا کنید"></textarea> <br />
';
echo 'گزینش شماره : <select name="number">
<option value="">گزینش کنید</option>
';
foreach( $feature->loop_number as $k => $v ) {
echo '<option value="'.$v->title.'">'.$v->title.'</option>';
}
echo '</select><br />';
echo 'گزینش هزینه : <select name="price">
<option value="">گزینش کنید</option>
';
foreach( $feature->loop_price as $k => $v ) {
echo '<option value="'.$v->id.'">'.$v->title.'</option>';
}
echo '</select><br />';
echo '<input type="file" name="uploadfiles"><br />';
echo '<input type="submit" value="send" />';
echo '</form>';
if( isset( $_GET['send'] ) ) {
//upload file
$tmpfile = $_FILES["uploadfiles"]["tmp_name"];
$filename = $_FILES["uploadfiles"]["name"];
$uploadid = array();
if( @$handle = fopen($tmpfile, "r") ) {
$contents = fread( $handle, filesize( $tmpfile) );
fclose($handle);
if( !empty( $contents ) ) {
$encodeContent = base64_encode( $contents );
try {
$response = $client->__call( 'parsip.upload', array('09131111111', '123456', $filename, $encodeContent) );
$result = json_decode( $response);
print_r( $result );
if( $result->status === 1 ) {
$uploadid = array( $result->data->id );
}
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
try {
$response = $client->__call('parsip.send_voice', array( '09131111111', '123456', $_POST['uniqid'], $_POST['title'], $_POST['try'], $_POST['try_interval'], explode( "\r\n", $_POST['numbers'] ), '', 0, $uploadid, $_POST['price'], $_POST['number'], '1' ) );
$result = json_decode( $response );
print_r( $result );
} catch( SoapFault $e ) {
var_dump( $e );
}
}
?>
از این پس شما میتوانید با rest و فرستادن درخواست post به آدرس http://otp.safironline.ir/customer/rest پیامکی خود را بفرستید.
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
$res = rest()->request( 'sms/send', array( 'title' => 'test', 'try' => '1', 'numbers[0]' => '09131111111', 'numbers[1]' => '09131111112', 'content' => "پیامک تست", 'kind' => '1', 'calculate' => 0 ), function( $data ) {
$smsid = @$data->id;
if( $smsid ) {
$res = rest()->request( 'sms/info', array( 'smsid' => $smsid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
{"message":"درخواست فرستادن پیامک افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"id":"207"},"messageid":100}
$res = rest()->request( 'sms/send', array( 'title' => 'test', 'try' => '1', 'numbers[0]' => '09131111111', 'numbers[1]' => '09131111112','content' => 'تست پیامک', 'kind' => '1', 'calculate' => 1, 'code' => '', 'adata' => 'array()', 'return_ids' => '1' ), function( $data ) {
$smsid = @$data->id;
if( $smsid ) {
$res = rest()->request( 'sms/info', array( 'smsid' => $smsid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
{"message":"درخواست فرستادن پیامک افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"id":"208","ids":[]},"messageid":100}
اطلاعات پیامک
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/info', array( 'smsid' => 100) ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"id":"206","state":"1","state_send":"5","count":"1","sent":"1","complete":"1","reason0":"0","reason3":"0","reason4":"0","reason5":"0","reason8":"0","start_date":"1629125079","end_date":"1629125080","count_wrong_number":"0","status":{"state_send":["فرستاده نشده","فرستادن","خطا از اپراتور","ارسال به اپراتور","بازگشت هزینه و سود","به پایان رسیده","دریافت پاسخ پیامک ها"],"reason":{"0":"بدون وضعیت","3":"ارسال نشده به مخابرات","4":"ارسال شده به مخابرات","5":"لیست سیاه مخابرات","8":"ارسال شده به اپراتور","12":"پذیرش نشدن محتوای پیامک"}}},"messageid":501}
گرفتن چگونگی هر شماره با smsid ( گرفتن ریز پیامک )
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/detail', array( 'smsid' => '100', 'page' => '1', 'each_page' => '20' ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" نمایش ریز پیامک « تست »","status":1,"data":{"loop":[{"number":"09906687925","reason":"1","try":"0"}],"pagination":[{"next_page":1,"prev_page":1,"last":1,"number_page":1,"loop_sub":[{"page":1,"class":"page"}],"record":"1"}]},"messageid":905}
چگونگی شماره ها
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/detail_by_id', array( 'ids[]' => '15223658' ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"نمایش داده ها","status":1,"data":[{"id":"34276","number":"0990111111","try":"0","smsid":"206","code":null,"reason":"1"}],"messageid":151001}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/feature', array( ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"نمایش داده های پیامک","status":1,"data":{"loop_number":[],"loop_price":[{"price_irancell_fa":"20","price_irancell_en":"440","price_mci_fa":"20","price_mci_en":"440","price_rightel_fa":"20","price_rightel_en":"440"}]},"messageid":301}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys', array( ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"نمایش داده های کلید های پیامک","status":1,"data":{"0":{"state":"1","kind":"1","label":"کلید1","title":"منشی پیامک","repeat":"1","reply":"1","content":"تست","content_reply":"","number":"5000000056985"},"kind":{"1":"منشی پیامک","2":"نظرسنجی","3":"مسابقه","4":"نوبت دهی","5":"قرعه کشی"}},"messageid":501}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys_add', array( array( "numberid"=>"174","title"=>"منشی پیامک وب سرویس","kind"=>1,"label"=>"wsm1","check_key"=>1 ) ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" درخواست منشی پیامک با موفقیت ثبت شد ","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys_add', array( "numberid"=>"174","title"=>"نظرسنجی وب سرویس","kind"=>2,"keys[0]"=>"wspull1","keys[1]"=>"wspull2","check_key"=>1 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" درخواست نظرسنجی با موفقیت ثبت شد ","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys_add', array( "numberid"=>"174","title"=>"وب سرویس مسابقه","kind"=>2,"keys[]"=>"wspull1","keys[]"=>"wspull2","check_key"=>1 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" درخواست مسابقه با موفقیت ثبت شد ","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys_add', array( "numberid"=>"174","title"=>"وب سرویس نوبت دهی","kind"=>4,"label"=>"wsnobat","turn_time"=>15,"turn_days[0]"=>4,"turn_times[0][0]"=>"15:00","turn_times[0][1]"=>"16:00","turn_date_start[0]"=>"1400/07/27","turn_date_end[0]"=>"1400/07/27","content"=>"شماره نوبت #nobat# به شماره موبایل #mobile# در تاریخ #date# رزرو شد","content_reply"=>"متاسفانه نوبت ها پر شده است","check_key"=>1), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" درخواست نوبت دهی با موفقیت ثبت شد ","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys_add', array( "numberid"=>"174","title"=>"قرعه کشی وب سرویس","kind"=>5,"content"=>"کد رسید","content_reply"=>"کد شما ثبت شده است","check_key"=>1 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" درخواست قرعه کشی با موفقیت ثبت شد ","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys_edit', array( "id"=>50, "numberid"=>"174","title"=>"منشی پیامک وب سرویس","kind"=>1,"label"=>"wsm1","check_key"=>1 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" ویرایش انجام شد ","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys_edit', array("id"=>51, "numberid"=>"174","title"=>"نظرسنجی وب سرویس","kind"=>2,"keys[0]"=>"wspull1","keys[1]"=>"wspull2","check_key"=>1 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" ویرایش انجام شد ","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys_edit', array("id"=>52, "numberid"=>"174","title"=>"وب سرویس مسابقه","kind"=>2,"keys[]"=>"wspull1","keys[]"=>"wspull2","check_key"=>1 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" ویرایش انجام شد ","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys_edit', array("id"=>53, "numberid"=>"174","title"=>"وب سرویس نوبت دهی","kind"=>4,"label"=>"wsnobat","turn_time"=>15,"turn_days[0]"=>4,"turn_times[0][0]"=>"15:00","turn_times[0][1]"=>"16:00","turn_date_start[0]"=>"1400/07/27","turn_date_end[0]"=>"1400/07/27","content"=>"شماره نوبت #nobat# به شماره موبایل #mobile# در تاریخ #date# رزرو شد","content_reply"=>"متاسفانه نوبت ها پر شده است","check_key"=>1), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" ویرایش انجام شد ","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys_edit', array("id"=>54, "numberid"=>"174","title"=>"قرعه کشی وب سرویس","kind"=>5,"content"=>"کد رسید","content_reply"=>"کد شما ثبت شده است","check_key"=>1 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" ویرایش انجام شد ","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/serials_delete', array( "id" => 5 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"پاکسازی انجام شد","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/serials', array( ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"نمایش اطلاعات سریال های ثبت شده","status":1,"data":{"0":{"id":"21","keyid":"11","serial_number":"101","state":"0","title":"قرعه کشی","serial_repeat":"0"},"1":{"id":"20","keyid":"11","serial_number":"100","state":"0","title":"قرعه کشی","serial_repeat":"0"},"2":{"id":"14","keyid":"11","serial_number":"9138739467","state":"0","title":"قرعه کشی","serial_repeat":"0"},"3":{"id":"13","keyid":"11","serial_number":"113","state":"0","title":"قرعه کشی","serial_repeat":"0"},"4":{"id":"12","keyid":"11","serial_number":"112","state":"0","title":"قرعه کشی","serial_repeat":"0"},"5":{"id":"11","keyid":"11","serial_number":"111","state":"0","title":"قرعه کشی","serial_repeat":"0"},"6":{"id":"5","keyid":"11","serial_number":"10104","state":"0","title":"قرعه کشی","serial_repeat":"0"},"7":{"id":"4","keyid":"11","serial_number":"10103","state":"0","title":"قرعه کشی","serial_repeat":"0"},"8":{"id":"3","keyid":"11","serial_number":"10102","state":"0","title":"قرعه کشی","serial_repeat":"0"},"9":{"id":"2","keyid":"11","serial_number":"10101","state":"0","title":"قرعه کشی","serial_repeat":"0"},"10":{"id":"1","keyid":"11","serial_number":"10100","state":"1","title":"قرعه کشی","serial_repeat":"0"},"kind":{"1":"منشی پیامک","2":"نظرسنجی","3":"مسابقه","4":"نوبت دهی","5":"قرعه کشی"},"state":{"1":"استفاده شده","0":"استفاده نشده"},"serial_repeat(چند بار مصرف)":{"1":"بله","0":"خیر"}},"messageid":501}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/serials_add', array("kind_data"=>"1","lottery"=>11,"serial_repeat"=>1,"kind"=>1,"start_serial"=>1,"end_serial"=>2 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"سریال ها با موفقیت ثبت شد","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/serials_add', array("kind_data"=>"1","lottery"=>11,"serial_repeat"=>1,"kind"=>2,"import_upload_excel[]"=>1400 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"سریال ها با موفقیت ثبت شد","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/serials_edit', array( array("id"=>50, "serial_number"=>"سریال 1" ) ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" ویرایش انجام شد ","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms/keys_delete', array( "id" => 5 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"پاکسازی انجام شد","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
$res = rest()->request( 'sms_otp/send', array('title' => 'تست','numberid' => '90001000', 'numbers[0]' => '09131111111', 'code' => 'رمز شما عدد 100 می باشد' , 'kind' => '1', 'priceid' => '6', 'calculate ' => 1), function( $data ) {
$otpid = @$data->id;
if( $otpid ) {
$res = rest()->request( 'sms_otp/info', array( 'otpid' => $otpid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
<?php
{"message":"درخواست فرستادن کد یک بار مصرف افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"id":"39","duration":19},"messageid":100}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
$body = array('title' => 'تست','numberid' => '90001000', 'numbers' => '09131111111','content' => 'رمز شما عدد 100 می باشد');
$res = rest()->request( 'sms_otp/send_multi', array( 'body' => json_encode('$body'), 'priceid' => '6', 'calculate ' => 1), function( $data ) {
$otpid = @$data->id;
});
print_r( $res );
<?php
{"message":"درخواست فرستادن کد یک بار مصرف افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"ids":"39","otp_ids":54fg98741cvb5687},"messageid":100}
گرفتن چگونگی هر شماره با smsid ( گرفتن ریز پیامک یک بار مصرف )
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'sms_otp/detail', array( 'smsid' => '100', 'page' => '1', 'each_page' => '20' ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" نمایش ریز پیامک « تست »","status":1,"data":{"loop":[{"number":"09906687925","reason":"1","try":"0"}],"pagination":[{"next_page":1,"prev_page":1,"last":1,"number_page":1,"loop_sub":[{"page":1,"class":"page"}],"record":"1"}]},"messageid":905}
از این پس شما میتوانید با rest و فرستادن درخواست post به آدرس http://otp.safironline.ir/customer/rest پیامک آوای خود را بفرستید.
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'upload/add', array( 'files[]' => '@'.realpath('./test.wav') ), function( $data ) {
print_r( $data );
$uploadid = $data->id;
});
print_r( $res );
$res = rest()->request( 'voice/send', array( 'title' => 'test', 'try' => '1', 'numbers[0]' => '09131111111', 'numbers[1]' => '09131111112', 'uploadids[]' => $uploadid, 'kind' => '1', 'calculate' => 0 ), function( $data ) {
$voiceid = @$data->id;
if( $voiceid ) {
$res = rest()->request( 'voice/info', array( 'voiceid' => $voiceid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
<?php
{"message":"درخواست فرستادن پیامک آوا افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"id":"474","duration":9,"ids":["163"]},"messageid":100}{"message":"نمایش داده های پیامک آوا","status":1,"data":{"id":"474","state":"0","state_send":"0","duration":"9","count":"1","sent":"0","complete":"0","reason0":"0","reason3":"0","reason4":"0","reason5":"0","reason8":"0","start_date":"0","end_date":"0","count_wrong_number":"0","status":{"state_send":{"0":"فرستاده نشده","1":"فرستادن","3":"به پایان رسیده","4":"بازگشت هزینه و سود"},"reason":{"0":"زنگ نخورده","3":"بدون پاسخ","4":"پاسخ داده","5":"رد کردن تماس","8":"سرگرم ( مشغول )","11":"شماره نادرست","12":"پذیرش نشدن پیوست آوا"}}},"messageid":501}
$res = rest()->request( 'voice/send', array( 'title' => 'test', 'try' => '1', 'numbers[0]' => '09131111111', 'numbers[1]' => '09131111112', 'uploadids[]' => $uploadid, 'kind' => '1', 'calculate' => 0, 'code' => '', 'adata' => 'array()', 'return_ids' => '1' ), function( $data ) {
$voiceid = @$data->id;
if( $voiceid ) {
$res = rest()->request( 'voice/info', array( 'voiceid' => $voiceid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
<?php
{"message":"درخواست فرستادن پیامک آوا افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"id":"473","duration":9,"ids":["162"]},"messageid":100}
$res = rest()->request( 'voice/send', array( "title" => "وب سرویس نظرسنجی", "try" => "1" ,"uploadids[]" => 1308, "numbers[0]" => "09138739467", "kind" => "2", "calculate" => 0,"callerid" => "91023133","code"=>json_encode(array("code_digit_len"=>2,"code_digit_repeat"=>1,"question"=>"انتخاب کنید؟","options"=>json_encode(array(1=>"جواب 1",2=>"جواب 2") ) ) ) ), function( $data ) {
$voiceid = @$data->id;
if( $voiceid ) {
$res = rest()->request( 'voice/info', array( 'voiceid' => $voiceid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
<?php
{"message":"درخواست فرستادن پیامک آوا افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"id":"553","duration":11},"messageid":100}
$res = rest()->request( 'voice/send', array( "title" => "وب سرویس داده", "try" => "1", "uploadids[]" => 1308, "kind" => "4", "calculate" => 0 ,"callerid" => "91000000","code"=>json_encode(array("code_digit_len"=>2,"code_digit_repeat"=>1) ), function( $data ) {
$voiceid = @$data->id;
if( $voiceid ) {
$res = rest()->request( 'voice/info', array( 'voiceid' => $voiceid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
<?php
{"message":"درخواست فرستادن پیامک آوا افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"id":"553","duration":11},"messageid":100}
$res = rest()->request( 'voice/send', array( "title" => "وب سرویس otp", "try" => "1", "uploadids[]" => 1308, "kind" => "6", "calculate" => 0 ,"callerid" => "91000000","code"=>json_encode(array("code_digit_len"=>2,"code_digit_repeat"=>1,"otp_user_len"=>5,"play_kind"=>1) ), function( $data ) {
$voiceid = @$data->id;
if( $voiceid ) {
$res = rest()->request( 'voice/info', array( 'voiceid' => $voiceid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
<?php
{"message":" درخواست OTP به شماره 546 افزوده شد بعد از این با وب سرویس می توانید از این بسته استفاده نمایید ","status":1,"data":{"id":"546","duration":12},"messageid":100}
$res = rest()->request( 'voice/send', array( "title" => "وب سرویس otp", "try" => "1" , "numbers[0]" => "0913000000", "kind" => "5", "calculate" => 1 ,"callerid" => "9100000","code"=>json_encode(array("tree_start_code"=>"4") ), function( $data ) {
$voiceid = @$data->id;
if( $voiceid ) {
$res = rest()->request( 'voice/info', array( 'voiceid' => $voiceid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
<?php
{"message":"درخواست فرستادن پیامک آوا افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"id":"547","duration":7},"messageid":100}
اطلاعات پیامک آوا
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'voice/info', array( 'voiceid' => 100 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"نمایش داده های پیامک آوا","status":1,"data":{"id":"390","state":"1","state_send":"3","duration":"18","count":"2","sent":"2","complete":"2","reason0":"0","reason3":"0","reason4":"2","reason5":"0","reason8":"0","start_date":"1626008570","end_date":"1626008579","count_wrong_number":"0","status":{"state_send":{"0":"فرستاده نشده","1":"فرستادن","3":"به پایان رسیده","4":"بازگشت هزینه و سود"},"reason":{"0":"زنگ نخورده","3":"بدون پاسخ","4":"پاسخ داده","5":"رد کردن تماس","8":"سرگرم ( مشغول )","11":"شماره نادرست","12":"پذیرش نشدن پیوست آوا"}}},"messageid":501}
گرفتن چگونگی هر شماره با voiceid ( گرفتن ریز پیام آوا )
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'voice/detail', array( 'voiceid' => '100', 'page' => '1', 'each_page' => '20' ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" نمایش ریز پیامک آوا « تست »","status":1,"data":{"loop":[{"number":"09138739467","reason":"4","try":"0","duration":"7","code":null},{"number":"09906687925","reason":"4","try":"0","duration":"7","code":null},{"number":"09138739467","reason":"4","try":"0","duration":"11","code":null}],"pagination":[{"next_page":1,"prev_page":1,"last":1,"number_page":1,"loop_sub":[{"page":1,"class":"page"}],"record":"3"}]},"messageid":905}
چگونگی شماره ها
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'voice/detail_by_id', array( 'ids[]' => '109' ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"نمایش داده ها","status":1,"data":[{"id":"109","number":"09901111111","try":"0","duration":"6","voiceid":"430","code":null,"reason":"4"}],"messageid":151001}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'voice/feature', array( ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"نمایش داده های پیامک آوا","status":1,"data":{"loop_number":[{"id":"221","title":"90005555"}],"loop_price":[{"id":"1061","title":"نرخ پیام صوتی کاربران","duration":"30","price_in":"400","price_out":"400","price_out_n":"600","price_fax":"3200","price_otp":"0"}]},"messageid":301}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
$res = rest()->request( 'otp/send', array('title' => 'تست','numberid' => '5', 'numbers[0]' => '09131111111', 'code' => 100 , 'play_kind' => '1', 'fileid' => '300','repeat' => '1','priceid' => '6', 'calculate ' => 1), function( $data ) {
$otpid = @$data->id;
if( $otpid ) {
$res = rest()->request( 'otp/info', array( 'otpid' => $otpid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
<?php
{"message":"درخواست فرستادن کد یک بار مصرف افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"id":"39","duration":19},"messageid":100}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
$res = rest()->request( 'ocv/send', array('title' => 'تست','numberid' => '5', 'numbers[0]' => '09131111111', 'code' => 100 , 'play_kind' => '1', 'fileid' => '300','repeat' => '1','code_digit_len' => '5','priceid' => '6', 'calculate ' => 1), function( $data ) {
$otpid = @$data->id;
if( $otpid ) {
$res = rest()->request( 'ocv/info', array( 'otpid' => $otpid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
<?php
{"message":"درخواست فرستادن کد یک بار مصرف افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"id":"39","duration":19},"messageid":100}
از این پس شما میتوانید با rest و فرستادن درخواست post به آدرس http://otp.safironline.ir/customer/rest فکسی خود را بفرستید.
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
$res = rest()->request( 'fax/send', array( 'title' => 'test', 'try' => '1', 'numbers[0]' => '09131111111', 'numbers[1]' => '09131111112', 'files' => 5547, 'calculate' => 0 ), function( $data ) {
$faxid = @$data->id;
if( $faxid ) {
$res = rest()->request( 'fax/info', array( 'faxid' => $faxid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
{"message":"درخواست فرستادن فکس افزوده شد و پس از بررسی فرستاده خواهد شد.","status":1,"data":{"id":"207"},"messageid":100}
اطلاعات فکس
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'fax/info', array( 'faxid' => 100) ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"{"message":"نمایش داده های فکس","status":1,"data":{"id":"464","state":"1","state_send":"4","duration":"0","count":"1","sent":"1","complete":"1","reason0":"0","reason3":"0","reason4":"0","reason5":"1","reason8":"0","start_date":"1627475517","end_date":"1627475526","count_wrong_number":"0","status":{"state_send":["در حال ساخت فایل فکس","فرستاده نشده","فرستادن","به پایان رسیده","بازگشت هزینه و سود"],"reason":{"0":"زنگ نخورده","3":"بدون پاسخ","4":"پاسخ داده","5":"رد کردن تماس","8":"سرگرم ( مشغول )","11":"شماره نادرست","12":"پذیرش نشدن پیوست آوا"}}},"messageid":501}
گرفتن چگونگی هر شماره با faxid ( گرفتن ریز فکس )
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'fax/detail', array( 'faxid' => '100', 'page' => '1', 'each_page' => '20' ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" نمایش ریز فکس « وب سرویس »","status":1,"data":{"loop":[{"number":"09138739467","reason":"5","try":"0","duration":"0"}],"pagination":[{"next_page":1,"prev_page":1,"last":1,"number_page":1,"loop_sub":[{"page":1,"class":"page"}],"record":"1"}]},"messageid":905}
چگونگی شماره ها
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'fax/detail_by_id', array( 'ids[]' => '490' ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"نمایش داده ها","status":1,"data":[{"id":"830","number":"0913111111","try":"0","duration":"0","faxid":"379","reason":"5"}],"messageid":151001}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'fax/feature', array( ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"نمایش داده های فکس","status":1,"data":{"loop_number":[{"id":"221","title":"90005555"}],"loop_price":[{"id":"1061","title":"نرخ پیام صوتی کاربران","duration":"30","price_in":"400","price_out":"400","price_out_n":"600","price_fax":"3200","price_otp":"0"}]},"messageid":301}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'users/info', array( ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"نمایش شناسنامه کاربری","status":1,"data":{"id":"1xxx","name":"محمدی","email":"m@gmail.com","cash":"460948"},"messageid":601}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'users/add', array( 'admin_user' => 'test', 'admin_pass' => 'test','firstname' => 'test','lastname' => 'test','email' => 'a@a.com','mobile' => '0913888888','password' => 'test'), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":" کاربری با موفقیت ساخته شد ","status":1,"data":[],"messageid":33007}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'users/user_set_api_key', array( 'api_key' => 'test' ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"تنظیم کردن کلید وب سرویس","status":1,"data":{"id":"1956","api_key":"rkh2222:test"},"messageid":null}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'users/get_price_list', array( ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"نرخ نامه ی شما","status":1,"data":[[{"id":"3","title":" نرخ آوا پیام کاربران ارتباط","price_in":"155","price_out":"155","price_out_n":"172","price_fax":"3200","max":"10000000","min":"0","duration":"60"}],[{"id":"1061","title":"نرخ پیام صوتی کاربران ارتباط","price_in":"400","price_out":"400","price_out_n":"500","price_fax":"3200","max":"10000000","min":"0","duration":"30"}],[{"id":"16","title":"نرخ پیامک کاربران ارتباط","price_irancell_fa":"20","price_irancell_en":"440","price_mci_fa":"20","price_mci_en":"440","price_rightel_fa":"20","price_rightel_en":"440","max":"10000000","min":"0"}]],"messageid":null}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'users/check_username', array( 'name' => 'test' ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"تعداد نام کاربری های یافت شده","status":1,"data":{"count":"1"},"messageid":null}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'cash/add', array( 'title' => 'test' , 'price' => '10000'), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"این درخواست افزوده شد و پس از پذیرش دارایی شما افزوده خواهد شد. ","status":1,"data":{"id":"15543"},"messageid":null}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'cash/approve', array( 'admin_user' => 'test', 'admin_pass' => 'test', 'cashid' => '100'), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"ویرایش انجام شد","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'draft/add', array( ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"ریز داده های ناماندگار شما","status":1,"data":{"id":"3"},"messageid":12001}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'draft/numbers', array( "draftid"=>3,"numbers[0]"=>"09131111111","numbers[1]"=>"09131111111" ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"شماره ها افزوده شد.","status":1,"data":{"count":"2"},"messageid":12002}
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'draft/status', array( "draftid"=>3 ), function( $data ) {
print_r( $data );
});
print_r( $res );
?>
{"message":"وضعیت شماره ای افزوده شده.","status":1,"data":{"id":"3","count":"2"},"messageid":12006}
از این پس شما میتوانید با rest و فرستادن درخواست post به آدرس http://otp.safironline.ir/customer/rest پیامک آوای خود را بفرستید.
در زیر ما به وسیله زبان php به شما چگونگی به کار بردن rest را نشان خواهیم داد.
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
<meta charset="utf-8" />
<?php
$res = rest()->request( 'upload/add', array( 'files[]' => '@'.realpath('./test.wav') ), function( $data ) {
print_r( $data );
$uploadid = $data->id;
});
print_r( $res );
$res = rest()->request( 'voice/send', array( 'title' => 'test', 'try' => '1', 'numbers[0]' => '09131111111', 'numbers[1]' => '09131111112', 'uploadids[]' => $uploadid, 'kind' => '1', 'calculate' => 0 ), function( $data ) {
$voiceid = @$data->id;
if( $voiceid ) {
$res = rest()->request( 'voice/info', array( 'voiceid' => $voiceid ), function( $data ) {
print_r( $data );
});
}
});
print_r( $res );
همه ی کوشش ما بر این بوده که وب سرویس سامانه کاربند پسند و ساده باشد. چنانچه شما اینگونه نمی اندیشید میتوانید دیدگاه خودتان را با ما در میان بگذارید.
<?php
ini_set("display_errors", "On");
ini_set("soap.wsdl_cache_enabled", "0");
$wsdl="http://otp.safironline.ir/webservice/ws.php?wsdl";
$client=new soapclient( $wsdl ) or die("Error");
$username = "user";
$password = "pass";
$response = $client->__call("parsip.send_voice", array( $username, $password, "", "تست است", "0", "0", array( "09131111112", "09131111113" ), time(), 0, array( "http://www.../audio.wav" ), 0, "38332140", "1" ) );
$res = json_decode( $response, true );
print_r( $res );
if( $res["status"] === 1 ) {
$data = $res["data"];
$response = $client->__call("parsip.get_voice_info", array( $username, $password, $data["id"] ) );
$result = json_decode( $response, true );
print_r( $result );
$response = $client->__call("parsip.get_voice_detail", array( $username, $password, $data["id"], 1, 100 ) );
$result = json_decode( $response, true );
print_r( $result );
}
هر پیامی که وب سرویس سامانه بر میگرداند در برگیرنده یک messageid هست. ما اینجا همه ی messageid ها را به همراه پیام آن به شما نشان میدهیم.
Array
(
[17] => شناسه کاربری و یا گذواژه نادرست است.
[502] => برای این id داده ای در دست نیست
)
فرستادن پیامک آوا
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="uploadfiles"><br />
<input type="submit" name="submit" value="فرستادن"><br />
</form>
<?php
if( isset( $_POST['submit'] ) ) {
//upload file
$tmpfile = $_FILES["uploadfiles"]["tmp_name"];
$filename = $_FILES["uploadfiles"]["name"];
$uploadid = array();
if( @$handle = fopen($tmpfile, "r") ) {
$contents = fread( $handle, filesize( $tmpfile) );
fclose($handle);
if( !empty( $contents ) ) {
$encodeContent = base64_encode( $contents );
try {
$response = $client->__call( 'parsip.upload', array('09131111111', '123456', $filename, $encodeContent) );
$result = json_decode( $response);
print_r( $result );
if( $result->status === 1 ) {
$uploadid = array( $result->data->id );
}
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
}
{"message":"\u0628\u0627\u0631\u06af\u0632\u0627\u0631\u06cc \u0628\u0627 \u067e\u06cc\u0631\u0648\u0632\u06cc \u0627\u0646\u062c\u0627\u0645 \u0634\u062f","status":1,"data":{"id":"769"}}
stdClass Object
(
[message] => بارگزاری با پیروزی انجام شد
[status] => 1
[data] => stdClass Object
(
[id] => 769
)
)
از این پس شما میتوانید با rest و فرستادن درخواست post به آدرس http://otp.safironline.ir/customer/rest پیامکی خود را بفرستید.
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.send_sms",array($username,$password,0,"test", "1","", array("0913111111"), "test", "" ,0,"5000212365555"));
print_r($feature);
?>
stdClass Object ( [message] => درخواست فرستادن پیامک افزوده شد و پس از بررسی فرستاده خواهد شد. [status] => 1 [data] => stdClass Object ( [id] => 211 ) [messageid] => 100 )
$feature = $soap->request("parsip.send_sms",array($username,$password,0,"test", "1","", array("09131111111"),"test","",0,"50002123656986","1","","",array(json_encode("place"=>"esfahan","postal_code"=>"874158")),"1");
print_r($feature);
?>
stdClass Object ( [message] => درخواست فرستادن پیامک افزوده شد و پس از بررسی فرستاده خواهد شد. [status] => 1 [data] => stdClass Object ( [id] => 211 ) [messageid] => 100 )
اطلاعات پیامک
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_sms_info",array($username,$password,118));
print_r($feature);
?>
stdClass Object ( [message] => نمایش داده های پیامک [status] => 1 [data] => stdClass Object ( [id] => 118 [state] => 2 [state_send] => 4 [count] => 1 [sent] => 0 [complete] => 0 [reason0] => 0 [reason3] => 0 [reason4] => 0 [reason5] => 0 [reason8] => 0 [start_date] => 1608037880 [end_date] => 0 [count_wrong_number] => 0 [status] => stdClass Object ( [state_send] => Array ( [0] => فرستاده نشده [1] => فرستادن [2] => خطا از اپراتور [3] => ارسال به اپراتور [4] => بازگشت هزینه و سود [5] => به پایان رسیده [6] => دریافت پاسخ پیامک ها ) [reason] => stdClass Object ( [0] => بدون وضعیت [3] => ارسال نشده به مخابرات [4] => ارسال شده به مخابرات [5] => لیست سیاه مخابرات [8] => ارسال شده به اپراتور [12] => پذیرش نشدن محتوای پیامک ) ) ) [messageid] => 501 )
گرفتن چگونگی هر شماره با smsid ( گرفتن ریز پیامک )
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_sms_detail",array($username,$password,118,1,20));
print_r($feature);
?>
stdClass Object ( [message] => نمایش ریز پیامک « تست آخر » [status] => 1 [data] => stdClass Object ( [loop] => Array ( [0] => stdClass Object ( [number] => 09138739467 [reason] => 0 [try] => 0 ) ) [pagination] => Array ( [0] => stdClass Object ( [next_page] => 1 [prev_page] => 1 [last] => 1 [number_page] => 1 [loop_sub] => Array ( [0] => stdClass Object ( [page] => 1 [class] => page ) ) [record] => 1 ) ) ) [messageid] => 905 )
چگونگی شماره ها
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_sms_detail_by_id",array($username,$password,array( 34276 ) ) );
print_r($feature);
?>
stdClass Object ( [message] => نمایش داده ها [status] => 1 [data] => Array ( [0] => stdClass Object ( [id] => 34276 [number] => 09906611111 [try] => 0 [smsid] => 206 [code] => [reason] => 1 ) ) [messageid] => 151001 )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_sms_feature",array($username,$password));
print_r($feature);
?>
stdClass Object ( [message] => نمایش داده های پیامک [status] => 1 [data] => stdClass Object ( [loop_number] => Array ( [0] => stdClass Object ( [id] => 173 [line_kind] => 2 [title] => 50002123656986(سما ارتباط اسپادانا) [blacklist] => 0 [operatorid] => 1 ) [1] => stdClass Object ( [id] => 174 [line_kind] => 1 [title] => 50002123656985(صلابت سپاهان) [blacklist] => 1 [operatorid] => 2 ) ) [loop_price] => Array ( [0] => stdClass Object ( [id] => 11 [price_irancell_fa] => 133 [price_irancell_en] => 310 [price_mci_fa] => 123 [price_mci_en] => 310 [price_rightel_fa] => 123 [price_rightel_en] => 310 [operatorid] => 1 ) [1] => stdClass Object ( [id] => 13 [price_irancell_fa] => 134 [price_irancell_en] => 311 [price_mci_fa] => 124 [price_mci_en] => 311 [price_rightel_fa] => 124 [price_rightel_en] => 311 [operatorid] => 2 ) ) ) [messageid] => 301 )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_sms_keys",array($username,$password));
print_r($feature);
?>
stdClass Object ( [message] => نمایش داده های کلید های پیامک [status] => 1 [data] => stdClass Object ( [0] => stdClass Object ( [state] => 1 [kind] => 1 [label] => کلید1 [title] => منشی پیامک [repeat] => 1 [reply] => 1 [content] => تست [content_reply] => [number] => 5000000025525 ) [kind] => stdClass Object ( [1] => منشی پیامک [2] => نظرسنجی [3] => مسابقه [4] => نوبت دهی [5] => قرعه کشی ) ) [messageid] => 501 )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.sms_keys_add",array($username,$password,"174","منشی پیامک وب سرویس","wsm15","1"));
print_r($feature);
?>
stdClass Object ( [message] => درخواست منشی پیامک با موفقیت ثبت شد [status] => 1 [data] => Array ( ) [messageid] => )
$feature = $soap->request("parsip.sms_keys_add",array($username,$password,"174","نظرسنجی وب سرویس","","2","","","","","","","","","","","","","1",array("0"=>"sowspull1","1"=>"sowspull2")));
print_r($feature);
?>
stdClass Object ( [message] => درخواست نظرسنجی با موفقیت ثبت شد [status] => 1 [data] => Array ( ) [messageid] => )
$feature = $soap->request("parsip.sms_keys_add",array($username,$password,"174","مسابقه وب سرویس","","3","","","","","","","","","","","","","1",array("0"=>"sowspull3","1"=>"sowspull4")));
print_r($feature);
?>
stdClass Object ( [message] => درخواست مسابقه با موفقیت ثبت شد [status] => 1 [data] => Array ( ) [messageid] => )
$feature = $soap->request("parsip.sms_keys_add",array($username,$password,"174","وب سرویس نوبت دهی","wsnobat","4","","متاسفانه نوبت ها پر شده است","شماره نوبت #nobat# به شماره موبایل #mobile# در تاریخ #date# رزرو شد","","","","15",array("0"=>4),array(0=>array("0"=>"15:00","1"=>"16:00")),array(0=>"1400/07/27"),array(0=>"1400/07/27"),"","0"));
print_r($feature);
?>
stdClass Object ( [message] => درخواست نوبت دهی با موفقیت ثبت شد [status] => 1 [data] => Array ( ) [messageid] => )
$feature = $soap->request("parsip.sms_keys_add",array($username,$password,"174","قرعه کشی وب سرویس","","5","","کد شما ثبت شده است","کد رسید","","","","","","","","","","0"));
print_r($feature);
?>
stdClass Object ( [message] => درخواست قرعه کشی با موفقیت ثبت شد [status] => 1 [data] => Array ( ) [messageid] => )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.sms_keys_edit",array($username,$password,"50","174","منشی پیامک وب سرویس","wsm15","1"));
print_r($feature);
?>
stdClass Object ( [message] => ویرایش انجام شد [status] => 1 [data] => Array ( ) [messageid] => )
$feature = $soap->request("parsip.sms_keys_edit",array($username,$password,"51","174","نظرسنجی وب سرویس","","2","","","","","","","","","","","","","1",array("0"=>"sowspull1","1"=>"sowspull2")));
print_r($feature);
?>
stdClass Object ( [message] => ویرایش انجام شد [status] => 1 [data] => Array ( ) [messageid] => )
$feature = $soap->request("parsip.sms_keys_edit",array($username,$password,"52","174","مسابقه وب سرویس","","3","","","","","","","","","","","","","1",array("0"=>"sowspull3","1"=>"sowspull4")));
print_r($feature);
?>
stdClass Object ( [message] => ویرایش انجام شد [status] => 1 [data] => Array ( ) [messageid] => )
$feature = $soap->request("parsip.sms_keys_edit",array($username,$password,"53","174","وب سرویس نوبت دهی","wsnobat","4","","متاسفانه نوبت ها پر شده است","شماره نوبت #nobat# به شماره موبایل #mobile# در تاریخ #date# رزرو شد","","","","15",array("0"=>4),array(0=>array("0"=>"15:00","1"=>"16:00")),array(0=>"1400/07/27"),array(0=>"1400/07/27"),"","0"));
print_r($feature);
?>
stdClass Object ( [message] => ویرایش انجام شد [status] => 1 [data] => Array ( ) [messageid] => )
$feature = $soap->request("parsip.sms_keys_edit",array($username,$password,"54","174","قرعه کشی وب سرویس","","5","","کد شما ثبت شده است","کد رسید","","","","","","","","","","0"));
print_r($feature);
?>
stdClass Object ( [message] => ویرایش انجام شد [status] => 1 [data] => Array ( ) [messageid] => )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.sms_keys_delete",array($username,$password,47));
print_r($feature);
?>
stdClass Object ( [message] => پاکسازی انجام شد [status] => 1 [data] => Array ( ) [messageid] => )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_sms_serials",array($username,$password));
print_r($feature);
?>
stdClass Object ( [message] => نمایش اطلاعات سریال های ثبت شده [status] => 1 [data] => stdClass Object ( [0] => stdClass Object ( [id] => 21 [keyid] => 11 [serial_number] => 101 [state] => 0 [title] => قرعه کشی [serial_repeat] => 0 ) [1] => stdClass Object ( [id] => 20 [keyid] => 11 [serial_number] => 100 [state] => 0 [title] => قرعه کشی [serial_repeat] => 0 ) [2] => stdClass Object ( [id] => 14 [keyid] => 11 [serial_number] => 9138739467 [state] => 0 [title] => قرعه کشی [serial_repeat] => 0 ) [3] => stdClass Object ( [id] => 13 [keyid] => 11 [serial_number] => 113 [state] => 0 [title] => قرعه کشی [serial_repeat] => 0 ) [4] => stdClass Object ( [id] => 12 [keyid] => 11 [serial_number] => 112 [state] => 0 [title] => قرعه کشی [serial_repeat] => 0 ) [5] => stdClass Object ( [id] => 11 [keyid] => 11 [serial_number] => 111 [state] => 0 [title] => قرعه کشی [serial_repeat] => 0 ) [6] => stdClass Object ( [id] => 5 [keyid] => 11 [serial_number] => 10104 [state] => 0 [title] => قرعه کشی [serial_repeat] => 0 ) [7] => stdClass Object ( [id] => 4 [keyid] => 11 [serial_number] => 10103 [state] => 0 [title] => قرعه کشی [serial_repeat] => 0 ) [8] => stdClass Object ( [id] => 3 [keyid] => 11 [serial_number] => 10102 [state] => 0 [title] => قرعه کشی [serial_repeat] => 0 ) [9] => stdClass Object ( [id] => 2 [keyid] => 11 [serial_number] => 10101 [state] => 0 [title] => قرعه کشی [serial_repeat] => 0 ) [10] => stdClass Object ( [id] => 1 [keyid] => 11 [serial_number] => 10100 [state] => 1 [title] => قرعه کشی [serial_repeat] => 0 ) [kind] => stdClass Object ( [1] => منشی پیامک [2] => نظرسنجی [3] => مسابقه [4] => نوبت دهی [5] => قرعه کشی ) [state] => stdClass Object ( [1] => استفاده شده [0] => استفاده نشده ) [serial_repeat(چند بار مصرف)] => stdClass Object ( [1] => بله [0] => خیر ) ) [messageid] => 501 )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.sms_serials_add",array($username,$password,"11","1","1","1","2"));
print_r($feature);
?>
stdClass Object ( [message] => سریال ها با موفقیت ثبت شد [status] => 1 [data] => Array ( ) [messageid] => )
$feature = $soap->request("parsip.sms_serials_add",array($username,$password,"1","11","1","2","0","0",array(1400)));
print_r($feature);
?>
stdClass Object ( [message] => سریال ها با موفقیت ثبت شد [status] => 1 [data] => Array ( ) [messageid] => )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.sms_serials_edit",array($username,$password,"50","سریال 2"));
print_r($feature);
?>
stdClass Object ( [message] => ویرایش انجام شد [status] => 1 [data] => Array ( ) [messageid] => )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.sms_serials_delete",array($username,$password,47));
print_r($feature);
?>
stdClass Object ( [message] => پاکسازی انجام شد [status] => 1 [data] => Array ( ) [messageid] => )
فرستادن پیامک آوا
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
$feature = $soap->request("parsip.send_voice",array($username,$password,0,"تست", "1","", array("09138731111"), "" ,1,array(1308),"13","91023133","","","",1));
print_r($feature);
?>
stdClass Object ( [message] => درخواست فرستادن پیامک آوا افزوده شد و پس از بررسی فرستاده خواهد شد. [status] => 1 [data] => stdClass Object ( [id] => 482 [duration] => 9 ) [messageid] => 100 )
$feature = $soap->request("parsip.send_voice",array($username,$password,0,"تست", "1","", array("0913871111"), "" ,1,array(1308),"1051","91023133","1","",0,json_encode(array("place"=>"esfahan","postal_code"=>"81"))));
print_r($feature);
?>
stdClass Object ( [message] => ارزیابی هزینه پیامک آوا [status] => 1 [data] => stdClass Object ( [list_price] => Array ( [0] => stdClass Object ( [price_in] => 0 [price_out] => 0 [price_out_n] => 5670 [price_otp] => 0 [total_price] => 5670 [pa] => 9 [priceid] => 1051 ) ) [duration] => 9 [price_in] => 0 [price_out] => 0 [price_out_n] => 6 [price_otp] => 0 [not_valid] => 0 [total_number] => 6 ) [messageid] => 23 )
$feature = $soap->request("parsip.send_voice",array($username,$password,0,"تست", "1","", array("0913111111"), "" ,0,array(1308),"1051","91011111","2",json_encode(array("code_digit_len"=>2,"code_digit_repeat"=>1,"question"=>"انتخاب کنید؟","options"=>json_encode(array(1=>"جواب 1",2=>"جواب 2") ) )),array(),1));
print_r($feature);
?>
stdClass Object ( [message] => درخواست فرستادن پیامک آوا افزوده شد و پس از بررسی فرستاده خواهد شد. [status] => 1 [data] => stdClass Object ( [id] => 598 [duration] => 11 ) [messageid] => 100 )
$feature = $soap->request("parsip.send_voice",array($username,$password,0,"تست", "1","", array("09138731111"), "" ,1,array(1308),"13","91023133","4",json_encode(array("code_digit_len"=>2,"code_digit_repeat"=>1)),"",1));
print_r($feature);
?>
stdClass Object ( [message] => درخواست فرستادن پیامک آوا افزوده شد و پس از بررسی فرستاده خواهد شد. [status] => 1 [data] => stdClass Object ( [id] => 563 [duration] => 11 ) [messageid] => 100 )
$feature = $soap->request("parsip.send_voice",array($username,$password,0,"تست", "1","", array("09138731111"), "" ,1,array(1308),"13","91023133","5",json_encode(array("tree_start_code"=>4)),"",1));
print_r($feature);
?>
stdClass Object ( [message] => درخواست فرستادن پیامک آوا افزوده شد و پس از بررسی فرستاده خواهد شد. [status] => 1 [data] => stdClass Object ( [id] => 548 [duration] => 9 ) [messageid] => 100 )
$feature = $soap->request("parsip.send_voice",array($username,$password,0,"تست", "1","", array("09138731111"), "" ,1,array(1308),"13","91023133","6",json_encode(array("code_digit_len"=>2,"code_digit_repeat"=>1,"otp_user_len"=>5,"play_kind"=>1)),"",1));
print_r($feature);
?>
stdClass Object ( [message] => درخواست OTP به شماره 550 افزوده شد بعد از این با وب سرویس می توانید از این بسته استفاده نمایید [status] => 1 [data] => stdClass Object ( [id] => 550 [duration] => 12 ) [messageid] => 100 )
اطلاعات پیامک آوا
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_voice_info",array($username,$password,390));
print_r($feature);
?>
stdClass Object ( [message] => نمایش داده های پیامک آوا [status] => 1 [data] => stdClass Object ( [id] => 390 [state] => 1 [state_send] => 3 [duration] => 18 [count] => 2 [sent] => 2 [complete] => 2 [reason0] => 0 [reason3] => 0 [reason4] => 2 [reason5] => 0 [reason8] => 0 [start_date] => 1626008570 [end_date] => 1626008579 [count_wrong_number] => 0 [status] => stdClass Object ( [state_send] => stdClass Object ( [0] => فرستاده نشده [1] => فرستادن [3] => به پایان رسیده [4] => بازگشت هزینه و سود ) [reason] => stdClass Object ( [0] => زنگ نخورده [3] => بدون پاسخ [4] => پاسخ داده [5] => رد کردن تماس [8] => سرگرم ( مشغول ) [11] => شماره نادرست [12] => پذیرش نشدن پیوست آوا ) ) ) [messageid] => 501 )
گرفتن چگونگی هر شماره با voiceid ( گرفتن ریز پیام آوا )
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_voice_detail",array($username,$password,390,1,20));
print_r($feature);
?>
stdClass Object ( [message] => نمایش ریز پیامک آوا « تست » [status] => 1 [data] => stdClass Object ( [loop] => Array ( [0] => stdClass Object ( [number] => 091388844467 [reason] => 4 [try] => 0 [duration] => 7 [code] => ) [1] => stdClass Object ( [number] => 09906687925 [reason] => 4 [try] => 0 [duration] => 7 [code] => ) [2] => stdClass Object ( [number] => 09135555555 [reason] => 4 [try] => 0 [duration] => 11 [code] => ) ) [pagination] => Array ( [0] => stdClass Object ( [next_page] => 1 [prev_page] => 1 [last] => 1 [number_page] => 1 [loop_sub] => Array ( [0] => stdClass Object ( [page] => 1 [class] => page ) ) [record] => 3 ) ) ) [messageid] => 905 )
چگونگی شماره ها
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_voice_detail_by_id",array($username,$password,array( 34276 ) ) );
print_r($feature);
?>
stdClass Object ( [message] => نمایش داده ها [status] => 1 [data] => Array ( [0] => stdClass Object ( [id] => 109 [number] => 099066444444 [try] => 0 [duration] => 6 [voiceid] => 430 [code] => [reason] => 4 ) ) [messageid] => 151001 )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_voice_feature",array($username,$password));
print_r($feature);
?>
stdClass Object ( [message] => نمایش داده های پیامک آوا [status] => 1 [data] => stdClass Object ( [loop_number] => Array ( [0] => stdClass Object ( [id] => 169 [title] => 91023133 ) [1] => stdClass Object ( [id] => 175 [title] => 91025168 ) [2] => stdClass Object ( [id] => 179 [title] => 910291025169 ) ) [loop_price] => Array ( [0] => stdClass Object ( [id] => 1051 [title] => نرخ پایه پیام صوتی کاربران صندوق [duration] => 1 [price_in] => 214 [price_out] => 260 [price_out_n] => 205 [price_fax] => 400 [price_otp] => 0 ) ) ) [messageid] => 301 )
ارسال رمز یک بار مصرف برای پویش هایی که از قبل توسط voice/send ساخته شده باشند
$feature = $soap->request("parsip.send_otp",array($username,$password,501,array("09138731111"),110));
print_r($feature);
?>
stdClass Object ( [message] => رمز یک بار مصرف ثبت شد [status] => 1 [data] => stdClass Object ( [id] => 304 ) [messageid] => )
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.send_fax",array($username,$password,0,"تست", "1","", array("09138731111"),"",0,array(1328)));
print_r($feature);
?>
stdClass Object ( [message] => درخواست فرستادن فکس افزوده شد ارسال فکس حدود یک دقیقه زمان می برد. [status] => 1 [data] => stdClass Object ( [id] => 505 [duration] => 180 ) [messageid] => 100 )
اطلاعات فکس
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
<meta charset="utf-8" />
$feature = $soap->request("parsip.get_fax_info",array($username,$password,390));
print_r($feature);
?>
stdClass Object ( [message] => نمایش داده های فکس [status] => 1 [data] => stdClass Object ( [id] => 464 [state] => 1 [state_send] => 4 [duration] => 0 [count] => 1 [sent] => 1 [complete] => 1 [reason0] => 0 [reason3] => 0 [reason4] => 0 [reason5] => 1 [reason8] => 0 [start_date] => 1627475517 [end_date] => 1627475526 [count_wrong_number] => 0 [status] => stdClass Object ( [state_send] => Array ( [0] => در حال ساخت فایل فکس [1] => فرستاده نشده [2] => فرستادن [3] => به پایان رسیده [4] => بازگشت هزینه و سود ) [reason] => stdClass Object ( [0] => زنگ نخورده [3] => بدون پاسخ [4] => پاسخ داده [5] => رد کردن تماس [8] => سرگرم ( مشغول ) [11] => شماره نادرست [12] => پذیرش نشدن پیوست آوا ) ) ) [messageid] => 501 )
گرفتن چگونگی هر شماره با faxid ( گرفتن ریز فکس )
پارامتر های این متد را در زیر شفاف سازی کرده ایم :
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_fax_detail",array($username,$password,390));
print_r($feature);
?>
stdClass Object ( [message] => نمایش ریز فکس « وب سرویس » [status] => 1 [data] => stdClass Object ( [loop] => Array ( [0] => stdClass Object ( [number] => 09138739467 [reason] => 5 [try] => 0 [duration] => 0 ) ) [pagination] => Array ( [0] => stdClass Object ( [next_page] => 1 [prev_page] => 1 [last] => 1 [number_page] => 1 [loop_sub] => Array ( [0] => stdClass Object ( [page] => 1 [class] => page ) ) [record] => 1 ) ) ) [messageid] => 905 )
چگونگی شماره ها
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_fax_detail",array($username,$password,aaray(390)));
print_r($feature);
?>
stdClass Object ( [message] => نمایش داده ها [status] => 1 [data] => Array ( [0] => stdClass Object ( [id] => 830 [number] => 0913111111 [try] => 0 [duration] => 0 [faxid] => 379 [reason] => 5 ) ) [messageid] => 151001 )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_fax_feature",array($username,$password));
print_r($feature);
?>
stdClass Object ( [message] => نمایش داده های فکس [status] => 1 [data] => stdClass Object ( [loop_number] => Array ( [0] => stdClass Object ( [id] => 169 [title] => 91023133 ) [1] => stdClass Object ( [id] => 175 [title] => 91025168 ) [2] => stdClass Object ( [id] => 179 [title] => 910291025169 ) ) [loop_price] => Array ( [0] => stdClass Object ( [id] => 1051 [title] => نرخ پایه پیام صوتی کاربران صندوق [duration] => 1 [price_in] => 14 [price_out] => 60 [price_out_n] => 105 [price_fax] => 300 ) ) ) [messageid] => 301 )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_user_info",array($username,$password));
print_r($feature);
?>
stdClass Object ( [message] => نمایش شناسنامه کاربری [status] => 1 [data] => stdClass Object ( [id] => 1956 [name] => محمدی [email] => r@gmail.com [cash] => 321185 ) [messageid] => 601 )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.add_user",array("skamali2020","123456","testsoap","test","b@a.com","0913888888","test555"));
print_r($feature);
?>
stdClass Object ( [message] =>" کاربری با موفقیت ساخته شد ",[status]=>1,[data]=>[],[messageid]=>33007)
<meta charset="utf-8" />
<?php
class rest_client {
var $ch, $url, $data;
public static $instance;
public static function get_instance( $url = '', $data = array() ) {
if( ! self::$instance ) {
self::$instance = new self( $url, $data );
}
return self::$instance;
}
function rest_client( $url, $data ) {
$this->url = $url;
$this->data = $data;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
return $this;
}
function request( $req, $params = array(), $callback = '' ) {
curl_setopt($this->ch, CURLOPT_URL,$this->url.$req );
curl_setopt($this->ch, CURLOPT_POST,1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data + $params );
$response = curl_exec ($this->ch);
//echo $response;
$result = json_decode( $response );
if( (int)$result->status === 1 && ! empty( $callback ) ) {
$callback( $result->data );
}
return $result;
}
function estruct() {
curl_close ( $this->ch );
}
}
function rest( $url = '', $data = array() ) {
return rest_client::get_instance( $url, $data );
}
//intialize rest client instance
rest( 'http://otp.safironline.ircustomer/rest/', array( 'username' => '09131111111', 'password' => '123456' ) );
$feature = $soap->request("parsip.get_user_set_api_key",array($username,$password,"api_key" => "testsoap"));
print_r($feature);
?>
stdClass Object ( [message] =>تنظیم کردن کلید وب سرویس",[status]=>1,[data]=>[[id]=>[1956],[api_key]=>[rkh2222=>test],[messageid]=>null])
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.get_price_list",array($username,$password));
print_r($feature);
?>
stdClass Object ( [message] => نرخ نامه ی شما [status] => 1 [data] => Array ( [0] => Array ( ) [1] => Array ( [0] => stdClass Object ( [id] => 1051 [title] => نرخ پایه پیام صوتی کاربران صندوق [price_in] => 214 [price_out] => 260 [price_out_n] => 105 [price_fax] => 300 [max] => 100000000 [min] => 0 [duration] => 1 ) ) [2] => Array ( [0] => stdClass Object ( [id] => 11 [title] => نرخ پایه پیامک کاربران صندوق [price_irancell_fa] => 233 [price_irancell_en] => 310 [price_mci_fa] => 323 [price_mci_en] => 310 [price_rightel_fa] => 323 [price_rightel_en] => 310 [max] => 10000000 [min] => 0 ) ) ) [messageid] =>
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.check_username",array($username,$password,"sk"));
print_r($feature);
?>
stdClass Object ( [message] => تعداد نام کاربری های یافت شده [status] => 1 [data] => stdClass Object ( [count] => 0 ) [messageid] => )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.add_cash",array($username,$password,"test","10000"));
print_r($feature);
?>
stdClass Object ( [message] => این درخواست افزوده شد و پس از پذیرش دارایی شما افزوده خواهد شد. [status] => 1 [data] => stdClass Object ( [id] => 15581 ) [messageid] => )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.approve_cash",array($username,$password,"15581"));
print_r($feature);
?>
{"message":"ویرایش انجام شد","status":1,"data":[],"messageid":null}
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.draft",array($username,$password));
print_r($feature);
?>
stdClass Object ( [message] => ریز داده های ناماندگار شما [status] => 1 [data] => stdClass Object ( [id] => 5 ) [messageid] => 12001 )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.draft_numbers",array($username,$password,1,array("09131111111","09131111111")));
print_r($feature);
?>
stdClass Object ( [message] => شماره ها افزوده شد. [status] => 1 [data] => stdClass Object ( [count] => 1 ) [messageid] => 12002 )
<meta charset="utf-8" />
ini_set("soap.wsdl_cache_enabled", "0");
class soap_client{
public $client;
private function init(){
$wsdl='http://otp.safironline.ir\webservice/ws.php?wsdl';
try {
$this->client=new soapclient( $wsdl );
} catch( SoapFault $e ) {
var_dump( $e );
exit();
}
}
public function request($method,$param){
$this->init();
try {
$response = $this->client->__call($method, $param );
$result = json_decode( $response);
$feature = $result->data;
return $feature;
} catch( SoapFault $e ) {
var_dump( $e );
}
}
}
$soap = new soap_client();
$username = "rkh2000";
$password = "123456";
$feature = $soap->request("parsip.draft_status",array($username,$password,5));
print_r($feature);
?>
stdClass Object ( [message] => وضعیت شماره ای افزوده شده. [status] => 1 [data] => stdClass Object ( [id] => 5 [count] => 1 ) [messageid] => 12006 )