Jump to content

GetClientsProducts API error: Malformed UTF-8 characters


kferoz

Recommended Posts

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;
    }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated