Welcome Guest, Not a member yet? Register   Sign In
XML from result Need HELP!
#1

[eluser]prasie[/eluser]
Code:
<?php
$this->load->dbutil();

$data = $this->session->userdata('data_services');

                if($data['maskapai'] == 0)
             {
                 $airlines = array('airasia','batavia', 'citilink','lion', 'sriwijaya');
             }
             elseif($data['maskapai'] == 1)
             {
                 $airlines = array('airasia');
             }
             elseif($data['maskapai'] == 2)
             {
                 $airlines = array('batavia');
             }
             elseif($data['maskapai'] == 3)
             {
                 $airlines = array('citilink');
             }
             elseif($data['maskapai'] == 4)
             {
                        $airlines = array('garuda');
             }
                    elseif($data['maskapai'] == 5)
             {
                        $airlines = array('lion');
             }
                    elseif($data['maskapai'] == 6)
             {
                       $airlines = array('sriwijaya');
             }
                
                        $from = $data['from'];
                        $to = $data['to'];
                        $depdate = $data['depdate'];
                        $retdate = $data['retdate'];
                        $pax = $data['pax'];
                        $where1 ="(`from` = '$from' and `to` = '$to' and depdate = '$depdate' and pax = '$pax') ";
                        $where2 = "(`from` = '$to' and `to` = '$from' and depdate = '$retdate' and pax = '$pax')";
                        
               if ($data['returnType'] == 'RT')
               {
                $this->db->where($where1);    
    $this->db->where_in('airline', $airlines);
                $this->db->where('last_update >=', time()-7200);
                $this->db->or_where($where2);    
    $this->db->where_in('airline', $airlines);
                $this->db->where('last_update >=', time()-7200);
               }
               elseif ($data['returnType'] == 'OW')
               {
                $this->db->where($where1);    
    $this->db->where_in('airline', $airlines);
                $this->db->where('id','');
               }
   $query = $this->db->get('ticket_cache');

$config = array (
                  'root'    => 'root',
                  'element' => 'element',
                  'newline' => "\n",
                  'tab'     => "\t"
                );

$xml = $this->dbutil->xml_from_result($query,$config);
$this->session->unset_userdata('data_services');
$this->output->set_content_type('text/html');
$this->output->set_output($xml);
?>

all code running fine at my localhost and return the xml correctly
but when try to upload to myserver suddenly there is additional div dunno why seems yesterday works good , will appreciate any suggestion try to google seems find nothing
Code:
<div id="resdebug_scrap_result">pre>Array
(
)
</pre></div>
#2

[eluser]Clooner[/eluser]
Try using direct output using exit($xml) and not $this->output->set_output($xml) and see the result. Also you should set the content type to xml and not html!

#3

[eluser]rip_pit[/eluser]
i output xml with something like:
Code:
$this->output->set_header("Content-Type: application/xml");
    $data['starttag'] = '&lt;?xml version="1.0" encoding="UTF-8"?&gt;';
    $feed = $this->load->view('front/rss', $data, true);
    $this->output->set_output($feed);

the rss file contains the xml elements, like:

Code:
echo $starttag;
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  
  <channel>
    <category>title0</category>
    &lt;link&gt;url0&lt;/link&gt;


      <item>
        &lt;title&gt;title 1&lt;/title&gt;
        &lt;link&gt;url1&lt;/link&gt;
      </item>

      <item>
        &lt;title&gt;title 2&lt;/title&gt;
        &lt;link&gt;url2&lt;/link&gt;
      </item>


  </channel>
</rss>

i had problem including xml tag directly in the rss file itself it's why i have it in the controller.
#4

[eluser]prasie[/eluser]
i found the problem -_- seems my friends echo that div to debug the result that why returns that error, and my local have no problem cause of that one
#5

[eluser]rip_pit[/eluser]
be sure the profiler is disabled too Wink




Theme © iAndrew 2016 - Forum software by © MyBB