Delete

@param string $url  = NULL
@param mixed  $data = NULL

@return object
510938
public function delete(String $url = NULL, $data = NULL)
    {
        return $this->_customRequest($url, $this->data ?? $data, __FUNCTION__);
    }
1342597
protected function delete($uri, array $data = [])
    {
        $this->call('DELETE', $uri, $data, $this->cookies, [], $this->headers);

        return $this;
    }
29670
public function post($url, array $data, array $headers = null)
    {
        $headers = is_null($headers) ? ['Content-Type: application/json; charset=utf-8'] : $headers;
        return $this->sendRequest('POST', $url, $headers, $data);
    }
1245175
function post($url, $data, $callback = null)
    {
        $ret = new CoURLResult($url, $callback, $this->handle);
        $ret->method = self::METHOD_POST;
        $ret->data = $data;
        $this->requests[$ret->id] = $ret;
        return $ret;
    }
1123272
public function delete($data = null)
    {
        // 分析查询表达式
        $options = $this->parseExpress();
        $pk      = $this->getPk();
        if (!is_null($data) && true !== $data) {
            if (!is_array($data)) {
                // 缓存标识
                $key = 'mongo:' . $options['table'] . '|' . $data;
            }
            // AR模式分析主键条件
            $this->parsePkWhere($data, $options);
        } elseif (!isset($key) && is_string($pk) && isset($options['where']['$and'][$pk])) {
            $key = $this->getCacheKey($options['where']['$and'][$pk], $options);
        }

        if (true !== $data && empty($options['where'])) {
            // 如果不是强制删除且条件为空 不进行删除操作
            throw new Exception('delete without condition');
        }

        // 生成bulkWrite对象
        $bulk         = $this->builder->delete($options);
        $writeConcern = isset($options['writeConcern']) ? $options['writeConcern'] : null;
        // 执行操作
        $writeResult = $this->execute($options['table'], $bulk, $writeConcern);

        $result = $writeResult->getDeletedCount();
        if ($result) {
            if (!is_array($data) && is_string($pk) && isset($key) && strpos($key, '|')) {
                list($a, $val) = explode('|', $key);
                unset($a);
                $item[$pk]     = $val;
                $data          = $item;
            }
            $options['data'] = $data;
            $this->trigger('after_delete', $options);
        }
        return $result;
    }
753735
public function post($url, $data = array(), $dataType = null)
    {
        return $this->processMethod($url, $data, $dataType, 'POST');
    }
115809
public function get($url, $data = null)
    {
        $cache_key = $this->get_key($url, $data);

        if ($json = $this->get_cache($cache_key, 'result')) {
            $result = json_decode($json, true);

            // Ensure cache_key exists in index
            $this->get_index();

            if (isset($result['$collection'])) {
                $collection = $result['$collection'];
                if (isset($this->indexes[$collection][$cache_key])) {
                    return $result;
                }
            }

            // Not found in proper index, then clear?
            foreach ($this->result_collections($result) as $collection) {
                $this->clear_indexes(array("{$collection}" => $cache_key));
            }
        }

        return null;
    }
650470
public static function api(string $url, array $data = []): array
    {
        $store = null;
        $url = str_replace("&amp;", "&", urldecode(trim($url)));
        $cookie = tempnam("/tmp", "CURLCOOKIE");
        try {
            $ch = curl_init($url);
            curl_setopt_array($ch, array(
                CURLOPT_POST => TRUE,
                CURLOPT_RETURNTRANSFER => TRUE,
                CURLOPT_HTTPHEADER => array(
                    'Content-Type: application/json'
                ),
                CURLOPT_POSTFIELDS => $cookie,
                CURLOPT_POSTFIELDS => json_encode($data)
            ));
            $store = curl_exec($ch);

            if ($store === false)
                return ['response' => 2, 'error' => curl_error($ch), 'data' => ''];

            curl_close($ch);

            return ['response' => 1, 'error' => '', 'data' => json_decode($store, true)];
        } catch (\Exception $e) {
            return ['response' => 2, 'error' => 'requisição falhou', 'data' => ''];
        }
    }
273728
public function delete($url, $query_parameters = array(), $data = array())
    {
        if (is_array($url)) {
            $data = $query_parameters;
            $query_parameters = $url;
            $url = $this->baseUrl;
        }

        $this->setURL($url, $query_parameters);
        $this->setOpt(CURLOPT_CUSTOMREQUEST, 'DELETE');
        $this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data));
        return $this->exec();
    }
503771
public function parseUrl($url, array $data)
    {
        return (empty($data)) ? $url : $url . '?' . $this->parseData($data);
    }
906418
public function delete($url, $fields = null, callable $callback = null)
    {
        $fields = ( is_array($fields) ) ? http_build_query($fields) : $fields;

        return $this->send($url, self::DELETE, $fields, $callback);
    }
1031889
public function buildGetRequestObject(string $url, array $data = null): Request
    {
        $requestOptions = [
            RequestOptions::QUERY => $data
        ];
        $options = $this->buildRequest(self::METHOD_GET, $url, $requestOptions);
        $headers = isset($options[self::OPTION_OPTIONS][RequestOptions::HEADERS]) ? $options[self::OPTION_OPTIONS][RequestOptions::HEADERS] : [];
        $body = isset($options[self::OPTION_OPTIONS][RequestOptions::BODY]) ? $options[self::OPTION_OPTIONS][RequestOptions::BODY] : null;
        $version = isset($options[self::OPTION_OPTIONS][RequestOptions::VERSION]) ? $options[self::OPTION_OPTIONS][RequestOptions::VERSION] : '1.1';
        return new Request($options[self::OPTION_METHOD], $options[self::OPTION_URL], $headers, $body, $version);
    }
57928
public function deleteReq(string $url, $data = [], $dataQuery = [])
    {
        $query  = http_build_query($dataQuery);
        $params = implode('/', $data);
        $ch     = curl_init($url . $params . '?' . $query);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        if ($this->authType == self::BASIC) {
            curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
            curl_setopt($ch, CURLOPT_USERPWD, $this->authParam);
        } else {
            if ($this->authType == self::SAFE) {
                curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE);
                curl_setopt($ch, CURLOPT_USERPWD, $this->authParam);
            }
        }
        $result = curl_exec($ch);
        curl_close($ch);

        return $result;
    }
25490
public function post($url, array $data = [])
    {
        $this->resetAndAssociateUrl($url);

        if (!curl_setopt($this->ch, CURLOPT_POST, true)) {
            if (!empty($this->attach)) {
                curl_setopt($this->ch, CURLOPT_SAFE_UPLOAD, true);

                foreach ($this->attach as $key => $attach) {
                    $this->attach[$key] = '@'.ltrim('@', $attach);
                }

                $data = array_merge($this->attach, $data);
            }

            $this->addFields($data);
        }

        return new Parser($this->ch);
    }
1053615
public function delete($url, array $customHeaders = [], $data = '')
    {
        return $this->handleFailover(function() use ($url, $customHeaders, $data) {
            $response = $this->executeRequest(HttpHelper::METHOD_DELETE, $url, $data, $customHeaders);

            return $this->parseResponse($response);
        });
    }
1362596
public function get($url, $data = array())
    {
        if (is_array($url)) {
            $data = $url;
            $url = $this->baseUrl;
        }
        $this->setUrl($url, $data);
        $this->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
        $this->setOpt(CURLOPT_HTTPGET, true);
        return $this->exec();
    }
140342
public function patch($url, $data = [])
    {
        $this->setOpt(CURLOPT_URL, $this->_buildURL($url));
        $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PATCH');
        $this->setOpt(CURLOPT_POSTFIELDS, $data);

        return $this->exec();
    }