public function streaming($methodName, array $params, callable $callback)
    {
        $config = array_merge($this->defaultApiOptions, $this->streamingApis[$methodName]);

        foreach ($config['required'] as $key) {
            if (!array_key_exists($key, $params)) {
                throw new Exception($key . ' is required');
            }
        }

        // make url {method}.{format} or {method}/{id}.{format}
        $method = (isset($config['method'])) ? $config['method'] : $methodName;
        $format = 'json';
        $key = $config['#id'];
        $id = ($key != null && array_key_exists($key, $params)) ? $params[$key] : null;
        if ($id != null) {
            unset($params[$key]);
            $url = sprintf('%s/%s/%s.%s', $config['url'], $method, $id, $format);
        } else {
            $url = sprintf('%s/%s.%s', $config['url'], $method, $format);
        }

        if (!$callback) {
            throw new Exception('callback is required');
        }
        if (!is_callable($callback)) {
            throw new Exception('callback is not callabled');
        }
        $request = new StreamingRequest();
        $request->setCore($this);
        $request->useAssociativeArray($this->assoc);
        $request->setUserAgent($this->getUserAgent());
        $method = $config['http'] . 'JSON';
        return $request->$method($url, $params, $this->getAuth(), $callback);
    }
public function streaming($methodName, array $params, callable $callback)
    {
        $config = array_merge($this->defaultApiOptions, $this->streamingApis[$methodName]);

        foreach ($config['required'] as $key) {
            if (!array_key_exists($key, $params)) {
                throw new Exception($key . ' is required');
            }
        }

        // make url {method}.{format} or {method}/{id}.{format}
        $method = (isset($config['method'])) ? $config['method'] : $methodName;
        $format = 'json';
        $key = $config['#id'];
        $id = ($key != null && array_key_exists($key, $params)) ? $params[$key] : null;
        if ($id != null) {
            unset($params[$key]);
            $url = sprintf('%s/%s/%s.%s', $config['url'], $method, $id, $format);
        } else {
            $url = sprintf('%s/%s.%s', $config['url'], $method, $format);
        }

        if (!$callback) {
            throw new Exception('callback is required');
        }
        if (!is_callable($callback)) {
            throw new Exception('callback is not callabled');
        }
        $request = new StreamingRequest();
        $request->setCore($this);
        $request->useAssociativeArray($this->assoc);
        $request->setUserAgent($this->getUserAgent());
        $method = $config['http'] . 'JSON';
        return $request->$method($url, $params, $this->getAuth(), $callback);
    }
public function streaming ( $ methodName , array $ params , callable $ callback ) { $ config = array_merge ( $ this -> defaultApiOptions , $ this -> streamingApis [ $ methodName ] ) ; foreach ( $ config [ 'required' ] as $ key ) { if ( ! array_key_exists ( $ key , $ params ) ) { throw new Exception ( $ key . ' is required' ) ; } } // make url {method}.{format} or {method}/{id}.{format} $ method = ( isset ( $ config [ 'method' ] ) ) ? $ config [ 'method' ] : $ methodName ; $ format = 'json' ; $ key = $ config [ '#id' ] ; $ id = ( $ key != null && array_key_exists ( $ key , $ params ) ) ? $ params [ $ key ] : null ; if ( $ id != null ) { unset ( $ params [ $ key ] ) ; $ url = sprintf ( '%s/%s/%s.%s' , $ config [ 'url' ] , $ method , $ id , $ format ) ; } else { $ url = sprintf ( '%s/%s.%s' , $ config [ 'url' ] , $ method , $ format ) ; } if ( ! $ callback ) { throw new Exception ( 'callback is required' ) ; } if ( ! is_callable ( $ callback ) ) { throw new Exception ( 'callback is not callabled' ) ; } $ request = new StreamingRequest ( ) ; $ request -> setCore ( $ this ) ; $ request -> useAssociativeArray ( $ this -> assoc ) ; $ request -> setUserAgent ( $ this -> getUserAgent ( ) ) ; $ method = $ config [ 'http' ] . 'JSON' ; return $ request -> $ method ( $ url , $ params , $ this -> getAuth ( ) , $ callback ) ; }
Calls the Streaming API Method
@param string $methodName method name (ie. statuses/sample)
@param array $params key-value parameter for method
@param callable $callback callback function (ie. "function_name" or array(class, "method_name") or closure)
@return mixed
@throws Exception
Calls the Streaming API Method