original_string: public function callUrl($url, $args = array(), $returnType = 'raw', $requestType = 'GET', $cache = 300, $enctype = Zend_Http_Client::ENC_URLENCODED)
  	{
  		$body = null;
  		// use the method params to try caching the results
  		// need to add in the baseUrl we're connecting to, and any global params
  		// because the cache might be connecting via different users, and the
  		// different users will have different sessions. This might need to be
  		// tweaked to handle separate user logins at a later point in time
  		$cacheKey = md5($url . $requestType . var_export($args, true) . var_export($this->globalParams, true));
  
  		$requestType = isset($methodDetails['method']) ? $methodDetails['method'] : 'GET';
  
  		if (mb_strtolower($requestType) == 'get' && $cache) {
  			$body = CacheService::inst()->get($cacheKey);
  		}
  
  		if (!$body) {
  			$uri = $url;
  			$client = $this->getClient($uri);
  			$client->setMethod($requestType);
  			// set the encoding type
  			$client->setEncType($enctype);
  			$paramMethod = 'setParameter'.$requestType;
  			// make sure to add the alfTicket parameter
  			if ($this->globalParams) {
  				foreach ($this->globalParams as $key => $value) {
  					$client->$paramMethod($key, $value);
  				}
  			}
  
  			foreach ($args as $index => $pname) {
  				$client->$paramMethod($index, $pname);
  			}
  
  			// request away
  			$response = $client->request();
  
  			if ($response->isSuccessful()) {
  				$body = $response->getBody();
  				if ($cache) {
  					CacheService::inst()->store($cacheKey, $body, $cache);
  				}
  			} else {
  				if ($response->getStatus() == 500) {
  					error_log("Failure: ".$response->getBody());
  					error_log(var_export($client, true));
  				}
  				throw new FailedRequestException("Failed executing $url: ".$response->getMessage()." for request to $uri (".$client->getUri(true).')', $response->getBody());
  			}
  		}
  
  		// see what we need to do with it
  		if (isset($this->returnHandlers[$returnType])) {
  			$handler = $this->returnHandlers[$returnType];
  			return $handler->handleReturn($body);
  		} else {
  			return $body;
  		}
  	}
code: public function callUrl($url, $args = array(), $returnType = 'raw', $requestType = 'GET', $cache = 300, $enctype = Zend_Http_Client::ENC_URLENCODED)
  	{
  		$body = null;
  		// use the method params to try caching the results
  		// need to add in the baseUrl we're connecting to, and any global params
  		// because the cache might be connecting via different users, and the
  		// different users will have different sessions. This might need to be
  		// tweaked to handle separate user logins at a later point in time
  		$cacheKey = md5($url . $requestType . var_export($args, true) . var_export($this->globalParams, true));
  
  		$requestType = isset($methodDetails['method']) ? $methodDetails['method'] : 'GET';
  
  		if (mb_strtolower($requestType) == 'get' && $cache) {
  			$body = CacheService::inst()->get($cacheKey);
  		}
  
  		if (!$body) {
  			$uri = $url;
  			$client = $this->getClient($uri);
  			$client->setMethod($requestType);
  			// set the encoding type
  			$client->setEncType($enctype);
  			$paramMethod = 'setParameter'.$requestType;
  			// make sure to add the alfTicket parameter
  			if ($this->globalParams) {
  				foreach ($this->globalParams as $key => $value) {
  					$client->$paramMethod($key, $value);
  				}
  			}
  
  			foreach ($args as $index => $pname) {
  				$client->$paramMethod($index, $pname);
  			}
  
  			// request away
  			$response = $client->request();
  
  			if ($response->isSuccessful()) {
  				$body = $response->getBody();
  				if ($cache) {
  					CacheService::inst()->store($cacheKey, $body, $cache);
  				}
  			} else {
  				if ($response->getStatus() == 500) {
  					error_log("Failure: ".$response->getBody());
  					error_log(var_export($client, true));
  				}
  				throw new FailedRequestException("Failed executing $url: ".$response->getMessage()." for request to $uri (".$client->getUri(true).')', $response->getBody());
  			}
  		}
  
  		// see what we need to do with it
  		if (isset($this->returnHandlers[$returnType])) {
  			$handler = $this->returnHandlers[$returnType];
  			return $handler->handleReturn($body);
  		} else {
  			return $body;
  		}
  	}
code_tokens: public function callUrl ( $ url , $ args = array ( ) , $ returnType = 'raw' , $ requestType = 'GET' , $ cache = 300 , $ enctype = Zend_Http_Client :: ENC_URLENCODED ) { $ body = null ; // use the method params to try caching the results // need to add in the baseUrl we're connecting to, and any global params // because the cache might be connecting via different users, and the // different users will have different sessions. This might need to be // tweaked to handle separate user logins at a later point in time $ cacheKey = md5 ( $ url . $ requestType . var_export ( $ args , true ) . var_export ( $ this -> globalParams , true ) ) ; $ requestType = isset ( $ methodDetails [ 'method' ] ) ? $ methodDetails [ 'method' ] : 'GET' ; if ( mb_strtolower ( $ requestType ) == 'get' && $ cache ) { $ body = CacheService :: inst ( ) -> get ( $ cacheKey ) ; } if ( ! $ body ) { $ uri = $ url ; $ client = $ this -> getClient ( $ uri ) ; $ client -> setMethod ( $ requestType ) ; // set the encoding type $ client -> setEncType ( $ enctype ) ; $ paramMethod = 'setParameter' . $ requestType ; // make sure to add the alfTicket parameter if ( $ this -> globalParams ) { foreach ( $ this -> globalParams as $ key => $ value ) { $ client -> $ paramMethod ( $ key , $ value ) ; } } foreach ( $ args as $ index => $ pname ) { $ client -> $ paramMethod ( $ index , $ pname ) ; } // request away $ response = $ client -> request ( ) ; if ( $ response -> isSuccessful ( ) ) { $ body = $ response -> getBody ( ) ; if ( $ cache ) { CacheService :: inst ( ) -> store ( $ cacheKey , $ body , $ cache ) ; } } else { if ( $ response -> getStatus ( ) == 500 ) { error_log ( "Failure: " . $ response -> getBody ( ) ) ; error_log ( var_export ( $ client , true ) ) ; } throw new FailedRequestException ( "Failed executing $url: " . $ response -> getMessage ( ) . " for request to $uri (" . $ client -> getUri ( true ) . ')' , $ response -> getBody ( ) ) ; } } // see what we need to do with it if ( isset ( $ this -> returnHandlers [ $ returnType ] ) ) { $ handler = $ this -> returnHandlers [ $ returnType ] ; return $ handler -> handleReturn ( $ body ) ; } else { return $ body ; } }
docstring: Call a URL directly, without it being mapped to a configured web method.
  
  This differs from the above in that the caller already knows what
  URL is trying to be called, so we can bypass the business of mapping
  arguments all over the place.
  
  We still maintain the globalParams for this client though
  
  @param $url
  The URL to call
  @param $args
  Parameters to be passed on the call
  @return mixed
docstring_tokens: Call a URL directly without it being mapped to a configured web method .