public function indexAction($type) { $this->setType($type); $this->setUrlXml($this->getType()); $xml = file_get_contents($this->getUrlXml()); $xmlBuilder = new XmlBuilder(); $xml_dom = $xmlBuilder->loadXML($xml, true); $data = $xmlBuilder->toArray($xml_dom); unset($data['rss']['channel']['title'], $data['rss']['channel']['link'], $data['rss']['channel']['description'], $data['rss']['channel']['language']); $data = $data['rss']['channel']; if (!is_array($data['item'][0])) { $data = array('item' => array($data['item'])); } foreach ($data['item'] as $key => $item) { $data['item'][$key] = array('title' => $this->getTitle(), 'description' => $item['description'], 'image' => $item['linkfoto']); } $xmlBuilder->load($data); $xml_output = $xmlBuilder->createXML(true); $finfo = new \finfo(FILEINFO_MIME_TYPE); $this->app->response->header('Content-Type', 'content-type: ' . $finfo->buffer($xml_output)); echo $xml_output; }
private function builderSoapEnvelope(&$data) { $xml = new XmlBuilder('soap:Envelope', new XmlNormalizer()); $data['@attributes'] = $this->SOAP_ATTRIBUTES; $xml->load($this->soap); $xml->setRenderTypeAttributes(false); $request = $xml->createXML(true); $request = str_replace("soapBody", "soap:Body", $request); return $request; }