Jump to content

BrutalGT

Member
  • Posts

    6
  • Joined

  • Last visited

Everything posted by BrutalGT

  1. I need to be able to terminate a service from an Action Hook which isn't an available function in the API. I found that I could instead make a call to the URL directly at https://clients.website.com/admincp/clientsservices.php?userid=59823&id=23982&modop=terminate which seems to be a decent work around. How could I initiate a CURL connection with WHMCS as an admin first so that I could actually call this URL? I assume I may need to establish a session or potentially post this data, but I am at a loss. Any help would be greatly appreciated.
  2. I wrote a script for our business that will terminate services immediately when they are cancelled (as WHMCS does it on the next CRON Job). As the API lacks this functionality, I found the only way I could do this was by calling the URL of it directly and passing the UserID and ProductID such as... https://clients.website.com/admincp/clientsservices.php?userid=12886&id=68832&modop=terminate This works fine when I am logged into my admin account, however it obviously doesn't when called from a Hook. I am looking at the curl code from the External API examples, but I am not sure how I can use this to permit my hook to call that URL directly. What would need to be changed for this to work? $url = "https://clients.website.com/admincp/index.php"; $username = "admin"; $password = "asd89asd0"; $postfields = array(); $postfields["username"] = $username; $postfields["password"] = md5($password); $postfields["responsetype"] = "json"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $jsondata = curl_exec($ch); if (curl_error($ch)) die("Connection Error: ".curl_errno($ch).' - '.curl_error($ch)); curl_close($ch); $arr = json_decode($jsondata); # Decode JSON String print_r($arr); # Output XML Response as Array
  3. Anyone able to provide any insight?
  4. I just finished writing a provisioning module that creates a DNS name for our customers on our Plesk server. The module itself is working fine, and I have created products that work fine with this. However, as we offer DNS Names to customers with a specific product, I would like to make this an addon product that they can add for free. This way when the parent service is created/suspended/terminated, we can also create/suspend/terminate the sub-product. Is there any way to setup a secondary product as a sub-product? I have checked out Addons/Bundling but neither of these really seem to be what is needed.
  5. I just got my custom provisioning module finished up, and have a few small issues I need to address. I am trying to find the value specified for "Dedicated IP" on the product page, but have not been able to find the variable for it. I am assuming I am just going to have to pull this value straight from the MySQL Database, but wanted to confirm there is nothing like $params[dedicatedip] that I am missing. I have $serveraccesshash = $params["serveraccesshash"]; and have specified a setting there for my module that appears as "<site-id>1</site-id>". Is there any simple way of grabbing the value from this without manually parsing it? Thanks!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated