getContent() public method

Returns the content of the response body.
public getContent ( ) : mixed
return mixed Response body content, decoded for supported content types
示例#1
0
文件: Isgd.php 项目: phergie/phergie
 /**
  * Callback for when the URL has been shortened. Checks for error messages.
  *
  * @param Phergie_Plugin_Http_Response $response the response object
  *
  * @return string|bool the shortened url or false on failure
  */
 protected function onComplete($response)
 {
     if (strpos($response->getContent(), 'Error: ') === 0) {
         return false;
     }
     return $response->getContent();
 }
示例#2
0
文件: Gscio.php 项目: phergie/phergie
 /**
  * Callback for when the URL has been shortened. Checks for error messages.
  *
  * @param Phergie_Plugin_Http_Response $response the response object
  *
  * @return string|bool the shortened url or false on failure
  */
 protected function onComplete($response)
 {
     if ($response->getCode() == 201) {
         return $response->getContent();
     }
     return false;
 }
示例#3
0
 /**
  * Chews on reply from wunderground's API and spits out useful information
  *
  * @param Phergie_Plugin_Http_Response $response
  * @return array Array of useful information
  * @throws Phergie_Exception
  */
 public function parseWeatherInfo($response)
 {
     $xml = $response->getContent();
     if (isset($xml->results)) {
         $this->setBogusLocation(true);
         throw new Phergie_Exception("That location is too ambiguous.  Please be more specific.");
     }
     if (isset($xml->error)) {
         $this->setBogusLocation(true);
         throw new Phergie_Exception("That location was not found.");
     }
     $this->setBogusLocation(false);
     $co = $xml->current_observation;
     return array('tempString' => $co->temperature_string, 'weather' => $co->weather, 'wind_string' => $co->wind_string, 'wind_chill_string' => $co->windchill_string, 'heat_index_string' => $co->heat_index_string);
 }