lobuljen Posted October 31, 2013 Share Posted October 31, 2013 I have problem with adding clients with internal script via api. I have two custom fields witch are required and when I try to add client there error emerges telling me that one custom fields isn't fulfilled. I checked id (numbers) of custom fields and tried every way what come on my mind. $command = "addclient"; $adminuser = "lobuljen"; $values["firstname"] = "Test"; $values["lastname"] = "User"; $values["companyname"] = "WHMCS"; $values["email"] = "user@domain.com"; $values["address1"] = "123 Demo Street"; $values["city"] = "Demo"; $values["state"] = "Florida"; $values["postcode"] = "AB123"; $values["country"] = "US"; $values["phonenumber"] = "123456789"; $values["password2"] = "demo"; $customfields = array( '1' => "67565453546", '2' => "Pravna osoba" ); $values["customfields"] = base64_encode(serialize($customfields)) $values["1"] = "67565453546"; $values["currency"] = "1"; $results = localAPI($command,$values,$adminuser); Where is problem? 0 Quote Link to comment Share on other sites More sharing options...
lobuljen Posted November 19, 2013 Author Share Posted November 19, 2013 This is working solution give by support $customfields = array( '1' => "xxx", '2' => "xxx" ); $values["customfields"] = $customfields; $values["customfield"] = $customfields; It works well with internal api but for external api I found out myself that only this works as should $postfields["customfield[1]"] = "xxx"; $postfields["customfield[2]"] = "xxx"; Hope this will help to someone. 0 Quote Link to comment Share on other sites More sharing options...
didier1 Posted November 20, 2013 Share Posted November 20, 2013 as : $postfields["customfield[1]"] = "xxx"; Admin API ? $postfields["customfield[2]"] = "xxx"; password API ? thanks - - - Updated - - - Can you please give me the full integration if you don't mind because I dont know which string I shouls substitute ? thanks so much 0 Quote Link to comment Share on other sites More sharing options...
lobuljen Posted December 3, 2013 Author Share Posted December 3, 2013 You should substitute xxx with some value what should go to that index custom field. 0 Quote Link to comment Share on other sites More sharing options...
peterdavid Posted January 8, 2014 Share Posted January 8, 2014 I need use variable $variable inside of array, please help me. $customfields = array( '1' => "Google", '2' => $variable ); $values["customfields"] = base64_encode(serialize($customfields)) 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.