示例#1
0
 /**
  * Pushes a message to the given api key.
  * 
  * @author Mario Mueller <mario.mueller@mac@me.com>
  * @param ProwlMessage $oMessage
  * @return ProwlResponse
  */
 public function push(ProwlMessage $oMessage)
 {
     $oMessage->validate();
     $aParams['apikey'] = $oMessage->getApiKeysAsString();
     $aParams['providerkey'] = $this->sProviderKey;
     $aParams['application'] = $oMessage->getApplication();
     $aParams['event'] = $oMessage->getEvent();
     $aParams['description'] = $oMessage->getDescription();
     $aParams['priority'] = $oMessage->getPriority();
     array_map(create_function('$sAryVal', 'return str_replace("\\n","\\n", $sAryVal);'), $aParams);
     $sContextUrl = $this->sPushEndpoint;
     if (!$this->bIsPostRequest) {
         $sContextUrl .= '?';
     }
     $sParams = http_build_query($aParams);
     $sReturn = $this->execute($sContextUrl, $this->bIsPostRequest, $sParams);
     $this->oLastResponse = ProwlResponse::fromResponseXml($sReturn);
     return $this->oLastResponse;
 }