UgurBurak Posted June 29, 2021 Share Posted June 29, 2021 (edited) Hi, I 'am developing a provisioning module in WHMCS 8.2.0. Create Account function is sending parameters to cron. And cron executing a function in xxxx.php. No problem so far. But when i want to update service details with localapi, i'm getting this error. Error: {"result":"error","message":"Your license key is invalid"} Our license is valid owned license. Finally, my service updating code is here. $vmid = g_proxmox_explode_field($params['configoption2']); $pveusername = g_proxmox_explode_field($params['configoption13']); $pvepassword = g_proxmox_explode_field($params['configoption14']); $node_name = g_proxmox_explode_field($params['configoption17']); $command = 'UpdateClientProduct'; $postData = array( 'serviceid' => $params['serviceid'], 'serviceusername' => $os_username->username, 'servicepassword' => $selected_password, 'dedicatedip' => $selected_ip->ip_address, 'assignedips' => implode(PHP_EOL, $selected_ip_extras), 'customfields' => base64_encode( serialize( array( $vmid[0] => $generated_vmid, $pveusername[0] => $pve_username, $pvepassword[0] => $pve_password, $node_name[0] => $node ) ) ) ); $adminUsername = Capsule::table("tbladmins")->where("id", "1")->value('username'); $results = localAPI($command, $postData, $adminUsername); if($results['result'] != 'success'){ return 'Ürün bilgileri güncellenirken hata oluştu Hata: '.json_encode($results); } Edited June 29, 2021 by UgurBurak 0 Quote Link to comment Share on other sites More sharing options...
UgurBurak Posted June 29, 2021 Author Share Posted June 29, 2021 Anyway, i solved with remote API access. 0 Quote Link to comment Share on other sites More sharing options...
Paweł Dysput Posted January 28, 2022 Share Posted January 28, 2022 Remote API access - you mean via external API? If so, there could be problem with checking license because of server IP is different than frontend IP. When you validating license after reissue or for new installation, you do it via http(s)- so frontend IP is saved. If your frontend have dedicated IP then it is different from server IP - so running script via console/cron will use server IP and this one will be different from this validated in license. In cron/console there is not SERVER_ADDR and SERVER_HOST vars which is using for validation so IP will be get with something similar to this: gethostbyname(gethostname()) In your solution, you are using curl to connect http(s) (frontend IP is used), so it works fine because IP is validate correctly. IMO the best solution for this situation will be additional IP for license - you need to contact with support, but it could be hard way - they saying is not possible (of course it is ;)) 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.