dixonjoseph.k Posted October 28, 2015 Share Posted October 28, 2015 Hi, We have to update client products dynamically. For that we developed a script, it should update configurable custom field (which is a hidden filed) with static values. But it is not updating even it shows "Success" message. Please see the code below. <?php $url = "https://example.com:8081/includes/api.php"; $postfields["username"] ="test"; $postfields["password"] = md5("test"); $postfields["action"] = "updateclientproduct"; $postfields["serviceid"] = 229; $postfields["pid"] = 152; $postfields["autorecalc"] = 1; $postfields["configoptions"] = base64_encode(serialize(array(537 => array('optionid' => '7613', 'qty' => '1')))); $postfields["responsetype"] = "xml"; $query_string = ""; foreach ($postfields AS $k=>$v) $query_string .= "$k=".urlencode($v)."&"; $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); $xmldata = curl_exec($ch); if (curl_error($ch)) { die("Connection Error: ".curl_errno($ch).' - '.curl_error($ch)); } else { print_r($xmldata); } ?> The above script is trying to update product data in test licensed whmcs site and it is running from live whmcs directory. When it executes it shows as 'Success', but not updated. Please help. 0 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.