public function send($url, $method = 'GET', $data = null, callable $callback = null)
    {
        $this->curl($url);
        $this->setDefaultOptions();

        if (is_array($this->options))
        {
            if (count($this->options) > 0)
            {
                foreach ($this->options as $key => $value)
                {
                    $this->setOption($key, $value);
                }
            }
        }

        if ($method !== self::GET)
        {
            $this->method($method);
        }

        if ($method === self::POST || $method === self::PUT || $method === self::DELETE)
        {
            $this->setOption(CURLOPT_POSTFIELDS, $data);
        }

        $response = $this->execute();

        if (!$response)
        {
            $this->error();
        }

        $this->getInfo();
        $this->close();

        if ( is_callable($callback) )
        {
            $callback($this->response, $this->info, $this->errors);
        }

        return $response;
    }
public function send($url, $method = 'GET', $data = null, callable $callback = null)
    {
        $this->curl($url);
        $this->setDefaultOptions();

        if (is_array($this->options))
        {
            if (count($this->options) > 0)
            {
                foreach ($this->options as $key => $value)
                {
                    $this->setOption($key, $value);
                }
            }
        }

        if ($method !== self::GET)
        {
            $this->method($method);
        }

        if ($method === self::POST || $method === self::PUT || $method === self::DELETE)
        {
            $this->setOption(CURLOPT_POSTFIELDS, $data);
        }

        $response = $this->execute();

        if (!$response)
        {
            $this->error();
        }

        $this->getInfo();
        $this->close();

        if ( is_callable($callback) )
        {
            $callback($this->response, $this->info, $this->errors);
        }

        return $response;
    }
public function send ( $ url , $ method = 'GET' , $ data = null , callable $ callback = null ) { $ this -> curl ( $ url ) ; $ this -> setDefaultOptions ( ) ; if ( is_array ( $ this -> options ) ) { if ( count ( $ this -> options ) > 0 ) { foreach ( $ this -> options as $ key => $ value ) { $ this -> setOption ( $ key , $ value ) ; } } } if ( $ method !== self :: GET ) { $ this -> method ( $ method ) ; } if ( $ method === self :: POST || $ method === self :: PUT || $ method === self :: DELETE ) { $ this -> setOption ( CURLOPT_POSTFIELDS , $ data ) ; } $ response = $ this -> execute ( ) ; if ( ! $ response ) { $ this -> error ( ) ; } $ this -> getInfo ( ) ; $ this -> close ( ) ; if ( is_callable ( $ callback ) ) { $ callback ( $ this -> response , $ this -> info , $ this -> errors ) ; } return $ response ; }
Send Http query

@param string       $url
@param string       $method GET
@param string|array $data  null
@param callable     $callback null
@return mixed
Send Http query