07-27-2023, 12:36 AM
I'm currently working on some automation things in WHMCS. I've several custom products available in WHMCS:
Linux product 1
Linux product 2
Windows product 1
Windows product 2
I want to execute a bash script when an order accept and when the service terminate from the WHMCS. The script require an argument (IP address) which is a custom field for the above products. The script should fetch this custom field data containing IP address, and compare the products whether it is Linux or Windows and then pass it to the script as follows:
- If the product is a Linux one, then the script pass would be like "autoaccept.sh linux [IP]"
- If the product is Windows one, then the script call would be like "autoaccept.sh windows [IP]"
- Similar way, when the package terminate on WHMCS we have to call the script again with "autoterminate.sh [IP]"
The WHMCS AcceptOrder and AfterModuleTerminate hook can be used I guess. But not sure how we can fetch these custom field data and compare the products within hook PHP code there. Can anyone shed some light on this or help our me to code this correctly.
Any responses would be much appreciated!
Created the Bash scripts already, and is working perfectly. I'm new to WHMCS hook and PHP things, so stucked here.
Linux product 1
Linux product 2
Windows product 1
Windows product 2
I want to execute a bash script when an order accept and when the service terminate from the WHMCS. The script require an argument (IP address) which is a custom field for the above products. The script should fetch this custom field data containing IP address, and compare the products whether it is Linux or Windows and then pass it to the script as follows:
- If the product is a Linux one, then the script pass would be like "autoaccept.sh linux [IP]"
- If the product is Windows one, then the script call would be like "autoaccept.sh windows [IP]"
- Similar way, when the package terminate on WHMCS we have to call the script again with "autoterminate.sh [IP]"
The WHMCS AcceptOrder and AfterModuleTerminate hook can be used I guess. But not sure how we can fetch these custom field data and compare the products within hook PHP code there. Can anyone shed some light on this or help our me to code this correctly.
Any responses would be much appreciated!
Created the Bash scripts already, and is working perfectly. I'm new to WHMCS hook and PHP things, so stucked here.