kferoz Posted December 17, 2018 Share Posted December 17, 2018 Hi, "GetClientsProducts" API is giving error ("Error generating JSON encoded response: Malformed UTF-8 characters") with few records and working fine with other set of records in the same database. Also it works fine when I comment the code i.e. "'responsetype' => 'json'". With this change it works with all records and showing result in XML type. For my application, I need result in JSON format which I'm not able to do. Code is; function get_clientproducts($url, $ide, $sec, $cid) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'GetClientsProducts', 'username' => $ide, 'password' => $sec, 'clientid' => $cid, 'stats' => true, // 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); return $response; } 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.