예제 #1
0
 private function _request($data)
 {
     $atx = new ArrayToXML($data, array(), array());
     $fields = array("jsessionid" => isset($this->_jsessionid) ? $this->_jsessionid : '', "xml" => $atx->getXML());
     $response = $this->_httpPost($fields);
     if ($response) {
         $arr = xml2array($response);
         if (isset($arr["Envelope"]["Body"]["RESULT"]["SUCCESS"])) {
             return $arr;
         } else {
             throw new Exception("HTTP Error: Invalid data from the server");
         }
     } else {
         throw new Exception("HTTP request failed");
     }
 }
예제 #2
0
 /**
  * Private method: make the request
  *
  */
 private function _request($data, $replace = array(), $attribs = array())
 {
     if (is_array($data)) {
         $atx = new ArrayToXML($data, $replace, $attribs);
         $xml = $atx->getXML();
     } else {
         //assume raw xml otherwise, we need this because we have to build
         //  our own sometimes because assoc arrays don't support same name keys
         $xml = $data;
     }
     $fields = array("jsessionid" => isset($this->_jsessionid) ? $this->_jsessionid : '', "xml" => $xml);
     $response = $this->_httpPost($fields);
     if ($response) {
         $arr = ArrayToXML::xml2array($response);
         if (isset($arr["Envelope"]["Body"]["RESULT"]["SUCCESS"])) {
             return $arr;
         } else {
             //throw new \Exception("HTTP Error: Invalid data from the server");
         }
     } else {
         //throw new \Exception("HTTP request failed");
     }
 }
예제 #3
0
 /**
  * @var string $sOperation - Valid SilverPOP operation to perform. 
  * @var mixed $mData - Either an array of parameters to pass to the request || raw, validated XML string.  
  * @return string - SimpleXML Response Object ($oResponse->Body->RESULT);  
  *
  * Create the XML Payload. This method is only called from $this->fnRequest(); 
  */
 private function fnQuery($sOperation, $mData)
 {
     $oResponse = NULL;
     if (is_array($mData)) {
         $aData = array();
         $aData['Envelope']['Body'][$sOperation] = $mData;
         $oXML = new ArrayToXML($aData);
         $sXML = $oXML->getXML();
     } else {
         /*	
         	$mData could be raw data because sometimes this will need to be manually constructed 
         	(in the case of multiple child nodes, arrays cannot have the same index value);  
         */
         $sXML = $mData;
     }
     $aFields = array('jsessionid' => isset($this->sSessionID) ? $this->sSessionID : NULL, 'xml' => $sXML);
     $oResponse = $this->fnCURL($aFields);
     return $oResponse;
 }