![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
La cosa es que quiero implementar un script llamado xml category tree de mercadolibre en Dreamhost pero este aparentemente tiene la funcion fopen bloqueada.
Este es parte del codigo original que no anda en dreamhost:
Cita:
Y yo lo modifique asi pero tampoco anda $xml_parserCtree = xml_parser_create();
xml_set_element_handler($xml_parserCtree, "startElementCtree", "endElementCtree");
if ($xM_gzip == 'Y') {
$fpCtree = gzopen($xM_file, "r") or die('No se pudo generar con GZIP');
} else {
$fpCtree = fopen($xM_file, "r");
}
while ($dataCtree = fread($fpCtree, 4096)) {
xml_parse($xml_parserCtree, $dataCtree, feof($fpCtree));
}
xml_parser_free($xml_parserCtree);
?>
xml_set_element_handler($xml_parserCtree, "startElementCtree", "endElementCtree");
if ($xM_gzip == 'Y') {
$fpCtree = gzopen($xM_file, "r") or die('No se pudo generar con GZIP');
} else {
$fpCtree = fopen($xM_file, "r");
}
while ($dataCtree = fread($fpCtree, 4096)) {
xml_parse($xml_parserCtree, $dataCtree, feof($fpCtree));
}
xml_parser_free($xml_parserCtree);
?>
![enojado](http://static.forosdelweb.com/fdwtheme/images/smilies/enojado.png)
Cita:
Me da este error:$xml_parserCtree = xml_parser_create();
xml_set_element_handler($xml_parserCtree, "startElementCtree", "endElementCtree");
if ($xM_gzip == 'Y') {
$fpCtree = gzopen($xM_file, "r") or die('No se pudo generar con GZIP');
} else {
$ch = curl_init(); // inicializa um controlador
$timeout = 5; // define um timeout - 5 é o que uso sempre
curl_setopt ($ch, CURLOPT_URL, $xM_file); // $url é a URL a ser aberta
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$res = curl_exec($ch); // salva o resultado em $res
//curl_close($ch); // fecha o controlador, para economizar memória
}
while ($dataCtree = fread($ch, 4096)) {
xml_parse($xml_parserCtree, $dataCtree, feof($ch));
}
xml_parser_free($xml_parserCtree);
?>
xml_set_element_handler($xml_parserCtree, "startElementCtree", "endElementCtree");
if ($xM_gzip == 'Y') {
$fpCtree = gzopen($xM_file, "r") or die('No se pudo generar con GZIP');
} else {
$ch = curl_init(); // inicializa um controlador
$timeout = 5; // define um timeout - 5 é o que uso sempre
curl_setopt ($ch, CURLOPT_URL, $xM_file); // $url é a URL a ser aberta
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$res = curl_exec($ch); // salva o resultado em $res
//curl_close($ch); // fecha o controlador, para economizar memória
}
while ($dataCtree = fread($ch, 4096)) {
xml_parse($xml_parserCtree, $dataCtree, feof($ch));
}
xml_parser_free($xml_parserCtree);
?>
Resource id #2http://www.mercadolibre.com.ar/jm/categsXml?as_site_id=MLA&gzip=N&as_categ_id=&as_ma x_level=4
Warning: fread(): supplied resource is not a valid stream resource in /home/.lillie/jovencato/paginade.com.ar/xml-categorytree.php on line 189
Saludos y gracias por todo de antemano