PHP Formdata Curl

/**
     * post curl with array post fields
     *
     * @param Array $postFields
     * @return boolean
     */
    private function formDataCurl(array $postFields, string $url, $form = false)
    {
        $post = $postFields;
        if (count($post) == 0) {
            return false;
        }

        $url = trim($url);



        $postdata = $post;
        if ($form == false) {
            $postdata = json_encode($post, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
        }


        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        if ($form == false) {
            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
        }
        $result = curl_exec($ch);
        curl_close($ch);

        return $decodedResult = json_decode($result, JSON_UNESCAPED_UNICODE);
    }
Lucky Llama