Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * WHMCS Sample API Call
- *
- * @package WHMCS
- * @author WHMCS Limited <development@whmcs.com>
- * @copyright Copyright (c) WHMCS Limited 2005-2016
- * @license http://www.whmcs.com/license/ WHMCS Eula
- * @version $Id$
- * @link http://www.whmcs.com/
- */
- // The fully qualified URL to your WHMCS installation root directory
- $whmcsUrl = "https://portal.goosevpn.com/";
- // Admin username and password
- $username = "reaper";
- $password = "82ifyc82";
- // Set post values
- $postfields = array(
- 'username' => $username,
- 'password' => md5($password),
- 'action' => 'validatelogin',
- 'email' => 'misha.vavryniuk@gmail.com',
- 'password2' => urlencode('hN&jr4g_tmk#?c3'),
- 'responsetype' => 'json',
- );
- // Call the API
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $whmcsUrl . 'includes/api.php');
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
- $response = curl_exec($ch);
- if (curl_error($ch)) {
- die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch));
- }
- curl_close($ch);
- // Attempt to decode response as json
- $jsonData = json_decode($response, true);
- // Dump array structure for inspection
- var_dump($jsonData);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement