Returns the content of the response body.
public getContent ( ) : mixed | ||
리턴 | mixed | Response body content, decoded for supported content types |
/** * 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(); }
/** * 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; }
/** * 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); }