تحقق من OTP باستخدام PHP
تحقق من رمز OTP (كلمة مرور واحدة) تم إنشاؤه مسبقًا باستخدام PHP
PHP : وثائق API
- إنشاء مجموعة باستخدام PHP
- الحصول على قائمة حقول المجموعة باستخدام PHP
- إضافة حقل إلى مجموعة بها PHP
- حذف حقل من مجموعة بها PHP
- حذف جهة اتصال من مجموعة
- عيّن البلد إلى مجموعة بها PHP
- الحصول على قائمة جهات اتصال المجموعة باستخدام PHP
- إضافة جهة اتصال إلى مجموعة بها PHP
- تعديل جهة اتصال مجموعة بها PHP
- حذف جهة اتصال لمجموعة بها PHP
تحقق من OTP باستخدام PHP
<?
$class="otp";
$method="verifyotp";
$user="user";
$password="password";
$destination="34600000000";
$code="A73HF3I";
$output="";
$result = file_get_contents("https://www.afilnet.com/api/http/?class=".$class."&method=".$method."&user=".$user."&password=".$password."&destination=".$destination."&code=".$code."&output=".$output);
?>
<?
$url = "https://www.afilnet.com/api/http/";
$fields = array(
"class" => urlencode("otp"),
"method" => urlencode("verifyotp"),
"user" => urlencode("user"),
"password" => urlencode("password"),
"destination" => urlencode("34600000000"),
"code" => urlencode("A73HF3I"),
"output" => urlencode(""),
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
$result = curl_exec($ch);
curl_close($ch);
?>
<?
$url = "https://www.afilnet.com/api/basic/";
$fields = array(
"class" => urlencode("otp"),
"method" => urlencode("verifyotp"),
"destination" => urlencode("34600000000"),
"code" => urlencode("A73HF3I"),
"output" => urlencode(""),
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_USERPWD, $user.":".$password);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch,CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpcode == 401)
{
// LOGIN ERROR
} else {
// SUCCESS LOGIN
}
?>
<?
# This example requires nusoap
require_once('nusoap.php');
$class="otp";
$method="verifyotp";
$user="user";
$password="password";
$destination="34600000000";
$code="A73HF3I";
$output="";
# Create SOAP Client
$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');
# Call to method
$result = $soapclient->call($user, $password, $class, $method, '{"destination":"'.$destination.'","code":"'.$code.'","output":"'.$output.'"}');
?>
معامل | وصف | إجباري / اختياري |
---|---|---|
class=otp | الفئة المطلوبة: الفئة التي تم تقديم الطلب إليها | إلزامي |
method=verifyotp | طريقة الفصل المطلوبة: طريقة الفصل الذي تم تقديم الطلب إليه | إلزامي |
user | المستخدم والبريد الإلكتروني لحساب Afilnet الخاص بك | إلزامي |
password | كلمة المرور لحساب Afilnet الخاص بك | إلزامي |
destination | رقم الجوال أو البريد الإلكتروني للوجهة | إلزامي |
code | كلمة المرور للتحقق | اختياري |
output | تنسيق الإخراج من النتيجة | اختياري |
عند تقديم طلبات ، ستتلقى الحقول التالية:
- status
-
النتيجة (إذا كانت الحالة = النجاح) ، سوف تتلقى هنا القيم التالية:
- لن يتم إرسال قيم إضافية إليك
- خطأ (إذا كانت الحالة = خطأ) ، هنا ستتلقى رمز الخطأ
يتم سرد رموز الأخطاء المحتملة أدناه
الشفرة | وصف |
---|---|
MISSING_USER | المستخدم أو البريد الإلكتروني غير المدرجة |
MISSING_PASSWORD | كلمة المرور غير المدرجة |
MISSING_CLASS | الطبقة غير المدرجة |
MISSING_METHOD | طريقة غير المدرجة |
MISSING_COMPULSORY_PARAM | المعلمة الإجبارية غير المدرجة |
INCORRECT_USER_PASSWORD | مستخدم غير صحيح أو كلمة المرور |
INCORRECT_CLASS | فئة غير صحيحة |
INCORRECT_METHOD | طريقة غير صحيحة |
CODE_NOT_FOUND | ERROR_CODE_NOT_FOUND |
المعلمات:
- class : otp
- method : verifyotp
- user : user
- password : password
- destination : 34600000000
- code : A73HF3I
- output :
طلب:
https://www.afilnet.com/api/http/?class=otp&method=verifyotp&user=user&password=password&destination=34600000000&code=A73HF3I&output=