getContent() публичный Метод

Returns the content of the response body.
public getContent ( ) : mixed
Результат mixed Response body content, decoded for supported content types
Пример #1
0
 /**
  * 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
 /**
  * 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);
 }