User Tools

Site Tools


pvs:integrate_customdevkit

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
pvs:integrate_customdevkit [2016/03/03 15:59]
rsk
pvs:integrate_customdevkit [2020/03/21 16:27]
rsk
Line 8: Line 8:
   * Knowledge of PHP   * Knowledge of PHP
  
 +===== Please Remember =====
 +
 +  * <php>$phone</php> variable will be automatically supplied, and contains the customer's phone number
 +  * <php>$code</php>  variable will be automatically supplied, and contains a 4 digit code
 +
 +===== The Steps =====
 +
 +  * open customdevkit.php file (which can be found in the Layer's PVS Module folder)
 +  * provide the API credentials in the script, this depends on the Gateway provider. Some call them username/passwords, while others give them different names
 +  * provide the content of the SMS message in the <php>$body</php> variable, remember to include the <php>$code</php> variable in your message, as that is the code to be sent to the customer
 +  * build & execute the api request (have a look at example files from your gateway provider)
 +  * log the API Request attempt to help troubleshoot
 +===== Example =====
 +
 +The example shows how to integrate Clickatell's API using the Custom Dev Kit.
 +
 +<file php customdevkit.php>
 +<?php
 +#  MyRSK's Phone Verification System for WHMCS (Custom Dev Kit Example)
 +#
 +#  This file contains an example to help you integrate any SMS provider API's gateway. 
 +#  The example below shows how to integrate Clickatell's API into MyRSK's PVS Module.
 +#  Please be advised that we do not provide support for custom integrations. 
 +#
 +#  $phone will be automatically supplied, and contains the customer's phone number
 +#  $code will be automatically supplied, and contains a 4 digit code
 +#
 +#  Example is provided below
 +
 +
 +#provide api credentials
 +$apiid="123456";
 +$apiuser="username";
 +$apipassword="password123";
 +
 +#provide the content of the SMS message - remember to include the $code variable in your message, as that is the code to be sent to the customer
 +$body="Hello! The verification code is: ".$code.". Thank you for verifying your account!";
 +
 +#build the API request
 +$url = 'http://api.clickatell.com/http/sendmsg?' . http_build_query([
 +        'user' => $apiuser,
 +        'password' => $apipassword,
 + 'api_id' => $apiid,
 +        'to' => $phone,
 +        'text' => $body
 +    ]);
 +
 +$ch = curl_init($url);
 +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 +$clickatell = curl_exec($ch);
 +
 +
 +#log the attempt to help troubleshoot
 +logModuleCall("myrskpvs","customdevkit-sms",$url,$clickatell);
 +
 +?>
 +</file>
pvs/integrate_customdevkit.txt · Last modified: 2020/03/22 09:15 by rsk