Welcome Guest, Not a member yet? Register   Sign In
how call a behind URL?
#1

[eluser]Asinox[/eluser]
Hi guy's, im writing a xml file (.xml), but i need to call a URL to "write" the data in this file, so, how ill call a behind url?

The xml file i'll use with flash, and i need to write the file every time that the user make a new entry.

Thanks, guys


XML FUNCTION
Code:
function xml(){
        $this->db->group_by('categoria_id');
        $data['relation'] = $this->admin_model->rel();

        $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
        $xml .= "<galeria>\n";
        foreach($data['relation'] as $row ){
            $data['categoria'] = $this->db->get_where('categorias',array('id'=>$row->categoria_id));    
            foreach($data['categoria']->result()as $row2){
            $xml .= "\t<categoria>\n";
                    $xml .= "\t\t<nombre>";
                    $xml .= xml_convert($row2->categoria);
                    $xml .= "</nombre>\n";
                    $data['fotos'] = $this->db->get_where('categorias_fotos',array('categoria_id'=>$row->categoria_id));
                $xml .= "\t\t<fotos>";
                    foreach($data['fotos']->result() as $row3){
                            $data['items'] = $this->db->get_where('fotos',array('id'=>$row3->foto_id));
                            foreach($data['items']->result() as $row4){
                                $xml .= "\t\t<item>";
                                    $xml .= xml_convert($row4->foto);
                                $xml .= "</item>\n";
                            }                            
                    }
                $xml .= "</fotos>\n";
            $xml .="\t</categoria>\n";
            }
        }
        $xml .= "</galeria>";            
        $archivo = "e://wamp//www//esteban//public/xml.xml";
        $open = fopen($archivo,'w')or die('No puede abrir archivo');
        fwrite($open,trim($xml));
        fclose($open);
        
        /*
        
        $this->load->vars($data);
        $this->load->view('xml');*/
    }
#2

[eluser]Asinox[/eluser]
Thanks, i did it with cURL

Code:
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://localhost/esteban/index.php/site/xml");
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$strPage = curl_exec($curl);
curl_close($curl);




Theme © iAndrew 2016 - Forum software by © MyBB