public function get($url) {
    if(!$this->db) {
      throw new SagException('No database specified');
    }

    //The first char of the URL should be a slash.
    if(strpos($url, '/') !== 0) {
      $url = "/$url";
    }

    $url = "/{$this->db}$url";

    if($this->staleDefault) {
      $url = self::setURLParameter($url, 'stale', 'ok');
    }

    //Deal with cached items
    $response = null;
    if($this->cache) {
      $prevResponse = $this->cache->get($url);

      if($prevResponse) {
        $response = $this->procPacket('GET', $url, null, array('If-None-Match' => $prevResponse->headers->etag));

        if($response->headers->_HTTP->status == 304) {
          //cache hit
          $response->fromCache = true;

          return $prevResponse;
        }

        $this->cache->remove($url);
      }

      unset($prevResponse);
    }

    /*
     * Not caching, or we are caching but there's nothing cached yet, or our
     * cached item is no longer good.
     */
    if(!$response) {
      $response = $this->procPacket('GET', $url);
    }

    if($this->cache) {
      $this->cache->set($url, $response);
    }

    return $response;
  }
public function get($url) {
    if(!$this->db) {
      throw new SagException('No database specified');
    }

    //The first char of the URL should be a slash.
    if(strpos($url, '/') !== 0) {
      $url = "/$url";
    }

    $url = "/{$this->db}$url";

    if($this->staleDefault) {
      $url = self::setURLParameter($url, 'stale', 'ok');
    }

    //Deal with cached items
    $response = null;
    if($this->cache) {
      $prevResponse = $this->cache->get($url);

      if($prevResponse) {
        $response = $this->procPacket('GET', $url, null, array('If-None-Match' => $prevResponse->headers->etag));

        if($response->headers->_HTTP->status == 304) {
          //cache hit
          $response->fromCache = true;

          return $prevResponse;
        }

        $this->cache->remove($url);
      }

      unset($prevResponse);
    }

    /*
     * Not caching, or we are caching but there's nothing cached yet, or our
     * cached item is no longer good.
     */
    if(!$response) {
      $response = $this->procPacket('GET', $url);
    }

    if($this->cache) {
      $this->cache->set($url, $response);
    }

    return $response;
  }
public function get ( $ url ) { if ( ! $ this -> db ) { throw new SagException ( 'No database specified' ) ; } //The first char of the URL should be a slash. if ( strpos ( $ url , '/' ) !== 0 ) { $ url = "/$url" ; } $ url = "/{$this->db}$url" ; if ( $ this -> staleDefault ) { $ url = self :: setURLParameter ( $ url , 'stale' , 'ok' ) ; } //Deal with cached items $ response = null ; if ( $ this -> cache ) { $ prevResponse = $ this -> cache -> get ( $ url ) ; if ( $ prevResponse ) { $ response = $ this -> procPacket ( 'GET' , $ url , null , array ( 'If-None-Match' => $ prevResponse -> headers -> etag ) ) ; if ( $ response -> headers -> _HTTP -> status == 304 ) { //cache hit $ response -> fromCache = true ; return $ prevResponse ; } $ this -> cache -> remove ( $ url ) ; } unset ( $ prevResponse ) ; } /*
     * Not caching, or we are caching but there's nothing cached yet, or our
     * cached item is no longer good.
     */ if ( ! $ response ) { $ response = $ this -> procPacket ( 'GET' , $ url ) ; } if ( $ this -> cache ) { $ this -> cache -> set ( $ url , $ response ) ; } return $ response ; }
Performs an HTTP GET operation for the supplied URL. The database name you
provided is automatically prepended to the URL, so you only need to give
the portion of the URL that comes after the database name.

You are responsible for URL encoding your own parameters.

@param string $url The URL, with or without the leading slash.
@return mixed
Performs an HTTP GET operation for the supplied URL . The database name you provided is automatically prepended to the URL so you only need to give the portion of the URL that comes after the database name .