コード例 #1
0
    /**
     * Format and sign an API request
     *
     * @return string
     * @ignore
     */
    private static function _request($url, $method, $params, $multi = false, $timeout = 0)
    {
        self::$url = $url;
        self::$params = $params;
        if (self::GET == $method) {
            $url = $url . (strpos($url, '?') ? '&' : '?') . (is_array($params) ? http_build_query($params) : $params);
            $response = self::_http($url, self::GET);
        } else {
            $headers = array();
            if (! $multi /*  && (is_array($params) || is_object($params)) */ ) {
                //$body = http_build_query($params);
                $body = $params;
            } else {
            	//TODO:目前没有使用
                $body = self::_buildHttpQueryMulti($params);
                $headers[] = "Content-Type: multipart/form-data; boundary=" . self::$boundary;
            }
            $response = self::_http($url, self::POST, $body, $headers, $timeout);
        }

        return self::_parseResponse($response);
    }