function sendPostData($url, $postdata, $file_field_array = array(), $ip = null, $timeout = 30)
    {
        //set various curl options first

        // set url to post to
        curl_setopt($this->ch, CURLOPT_URL, $url);

        // return into a variable rather than displaying it
        curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);

        //bind to specific ip address if it is sent trough arguments
        if ($ip)
        {
            if ($this->debug)
            {
                echo "Binding to ip $ip\n";
            }
            curl_setopt($this->ch, CURLOPT_INTERFACE, $ip);
        }

        //set curl function timeout to $timeout
        curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout);

        //set method to post
        curl_setopt($this->ch, CURLOPT_POST, true);

        // disable Expect header
        // hack to make it working
        $headers = array("Expect: ");
        curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);

        // initialize result post array
        $result_post = array();

        //generate post string
        $post_array = array();
        $post_string_array = array();
        if (!is_array($postdata))
        {
            return false;
        }

        foreach ($postdata as $key => $value)
        {
            $post_array[$key] = $value;
            $post_string_array[] = urlencode($key) . "=" . urlencode($value);
        }

        $post_string = implode("&", $post_string_array);


        if ($this->debug)
        {
            echo "Post String: $post_string\n";
        }

        // set post string
        //curl_setopt($this->ch, CURLOPT_POSTFIELDS, $post_string);


        // set multipart form data - file array field-value pairs
        if (!empty($file_field_array))
        {

            /*
             * TRUE to disable support for the @ prefix for uploading files in CURLOPT_POSTFIELDS
             * Added in PHP 5.5.0 with FALSE as the default value.
             * PHP 5.6.0 changes the default value to TRUE.
             * PHP 7 removes this option; the CURLFile interface must be used to upload files.
             */
            if (PHP_VERSION_ID >= 70000) {
                foreach ($file_field_array as $var_name => $var_value)
                {
                    $file_field_array[$var_name] = new \CURLFile($var_value);
                }
            } else {
                if (PHP_VERSION_ID >= 50600) {
                    curl_setopt ( $this->ch, CURLOPT_SAFE_UPLOAD, false);
                }
                foreach ($file_field_array as $var_name => $var_value)
                {
                    if (strpos(PHP_OS, "WIN") !== false)
                    {
                        $var_value = str_replace("/", "\\", $var_value);
                    }
                    $file_field_array[$var_name] = "@" . $var_value;
                }
            }
        }

        // set post data
        $result_post = array_merge($post_array, $file_field_array);
        curl_setopt($this->ch, CURLOPT_POSTFIELDS, $result_post);


        //and finally send curl request
        $result = curl_exec($this->ch);
        $this->info = curl_getinfo($this->ch);
        if ($this->info)
        {
            $this->httpCode = $this->info['http_code'];
        }
        if (curl_errno($this->ch))
        {
            $this->errCode = curl_errno($this->ch);
            $this->errMsg = curl_error($this->ch) . '[' . $this->errCode . ']';
            if ($this->debug)
            {
                \Swoole::$php->log->warn($this->errMsg);
            }
            return false;
        }
        else
        {
            return $result;
        }
    }