Utilizo la funcion creada x:
/**
* xml2array() will convert the given XML text to an array in the XML structure.
* Link: http://www.bin-co.com/php/scripts/xml2array/
*/
Al obtener el XML
Código:
Observamos que hay tildes, o ñ. Como hago para que cuando llame mediante file get contents al fichero XML <xml_api_reply version="1"> <weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0"> <forecast_information> <city data="Buenos Aires, Ciudad Autónoma de Buenos Aires"/> <postal_code data="Buenos Aires Argentina"/> <latitude_e6 data=""/> <longitude_e6 data=""/> <forecast_date data="2012-04-11"/> <current_date_time data="1970-01-01 00:00:00 +0000"/> <unit_system data="SI"/> </forecast_information> <current_conditions> <condition data="Neblina"/> <temp_f data="73"/> <temp_c data="23"/> <humidity data="Humedad: 72%"/> <icon data="/ig/images/weather/haze.gif"/> <wind_condition data="Viento: NE a 8 km/h"/> </current_conditions> <forecast_conditions> <day_of_week data="mié"/> <low data="17"/> <high data="26"/> <icon data="/ig/images/weather/fog.gif"/> <condition data="Niebla"/> </forecast_conditions> <forecast_conditions> <day_of_week data="jue"/> <low data="18"/> <high data="24"/> <icon data="/ig/images/weather/fog.gif"/> <condition data="Niebla"/> </forecast_conditions> <forecast_conditions> <day_of_week data="vie"/> <low data="18"/> <high data="24"/> <icon data="/ig/images/weather/fog.gif"/> <condition data="Niebla"/> </forecast_conditions> <forecast_conditions> <day_of_week data="sáb"/> <low data="16"/> <high data="23"/> <icon data="/ig/images/weather/fog.gif"/> <condition data="Niebla"/> </forecast_conditions> </weather> </xml_api_reply>
Código PHP:
$contents = file_get_contents($url);
Ya he probado con esto:
Código PHP:
function QuitarTildes($cadena) {
$no_permitidas= array ("á","é","í","ó","ú","Á","É","Í","Ó","Ú","ñ","À","Ã","Ì","Ò","Ù","Ù","à ","è","ì","ò","ù","ç","Ç","â","ê","î","ô","û","Â","Ê","ÃŽ","Ô","Û","ü","ö","Ö","ï","ä","«","Ò","Ã","Ä","Ë"," ");
$permitidas= array ("a","e","i","o","u","A","E","I","O","U","n","N","A","E","I","O","U","a","e","i","o","u","c","C","a","e","i","o","u","A","E","I","O","U","u","o","O","i","a","e","U","I","A","E","%2C");
$texto = str_replace($no_permitidas, $permitidas ,$cadena);
return $texto;
}
Alguien me enseña el camino ? =)