par
yoann38 » 12 juil. 2015, 11:34
Bonjour à toi, ca l'air de marcher sauf la fonction pour supprimer les accents je ne vois pas pourquoi ....
Si je supprime la fonction de ton code tt marche je récupere bien ma date genre :
2015-07-12
Mais si je remet ton code tel quel :
// Date
$date = @eregi('<tr style="font-weight: bold; background: #FFFFFF; font-size: 12px;">
<td style="color: #a2141e; width: 150px; padding-left: 5px;">Date : </td>
<td>(.*)</td>
</tr>
<tr style="font-weight: bold; background: #E8E8E8; font-size: 12px;">
<td style="color: #a2141e; width: 150px; padding-left: 5px;">Lieu : </td>',$page,$event);
echo "$event[1] <BR>" ;
$texte_original="$event[1]";
$jourmois_fr = array('janvier', 'fevrier', 'mars', 'avril', 'mai', 'juin', 'juillet', 'aout', 'septembre', 'octobre', 'novembre', 'decembre', 'lundi ', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche');
$jourmois_en = array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
$timestamp=strtotime(str_replace($jourmois_fr, $jourmois_en, strtolower(suppr_accents($texte_original))));
print date("Y-m-d", $timestamp);
/****** FONCTIONS ******/
function suppr_accents($string) {
return str_replace( array('à','á','â','ã','ä', 'ç', 'è','é','ê','ë', 'ì','í','î','ï', 'ñ', 'ò','ó','ô','õ','ö', 'ù','ú','û','ü', 'ý','ÿ', 'À','Á','Â','Ã','Ä', 'Ç', 'È','É','Ê','Ë', 'Ì','Í','Î','Ï', 'Ñ', 'Ò','Ó','Ô','Õ','Ö', 'Ù','Ú','Û','Ü', 'Ý'), array('a','a','a','a','a', 'c', 'e','e','e','e', 'i','i','i','i', 'n', 'o','o','o','o','o', 'u','u','u','u', 'y','y', 'A','A','A','A','A', 'C', 'E','E','E','E', 'I','I','I','I', 'N', 'O','O','O','O','O', 'U','U','U','U', 'Y'), $string);
}
Je me retrouve avec :
Fatal error: Call to undefined function suppr_accents() in C:\wamp\www\lasortie\admin\importerJSON.php on line 79
Call Stack
Bonjour à toi, ca l'air de marcher sauf la fonction pour supprimer les accents je ne vois pas pourquoi ....
Si je supprime la fonction de ton code tt marche je récupere bien ma date genre :
2015-07-12
Mais si je remet ton code tel quel :
[php]// Date
$date = @eregi('<tr style="font-weight: bold; background: #FFFFFF; font-size: 12px;">
<td style="color: #a2141e; width: 150px; padding-left: 5px;">Date : </td>
<td>(.*)</td>
</tr>
<tr style="font-weight: bold; background: #E8E8E8; font-size: 12px;">
<td style="color: #a2141e; width: 150px; padding-left: 5px;">Lieu : </td>',$page,$event);
echo "$event[1] <BR>" ;
$texte_original="$event[1]";
$jourmois_fr = array('janvier', 'fevrier', 'mars', 'avril', 'mai', 'juin', 'juillet', 'aout', 'septembre', 'octobre', 'novembre', 'decembre', 'lundi ', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche');
$jourmois_en = array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
$timestamp=strtotime(str_replace($jourmois_fr, $jourmois_en, strtolower(suppr_accents($texte_original))));
print date("Y-m-d", $timestamp);
/****** FONCTIONS ******/
function suppr_accents($string) {
return str_replace( array('à','á','â','ã','ä', 'ç', 'è','é','ê','ë', 'ì','í','î','ï', 'ñ', 'ò','ó','ô','õ','ö', 'ù','ú','û','ü', 'ý','ÿ', 'À','Á','Â','Ã','Ä', 'Ç', 'È','É','Ê','Ë', 'Ì','Í','Î','Ï', 'Ñ', 'Ò','Ó','Ô','Õ','Ö', 'Ù','Ú','Û','Ü', 'Ý'), array('a','a','a','a','a', 'c', 'e','e','e','e', 'i','i','i','i', 'n', 'o','o','o','o','o', 'u','u','u','u', 'y','y', 'A','A','A','A','A', 'C', 'E','E','E','E', 'I','I','I','I', 'N', 'O','O','O','O','O', 'U','U','U','U', 'Y'), $string);
}[/php]
Je me retrouve avec :
[b]Fatal error: Call to undefined function suppr_accents() in C:\wamp\www\lasortie\admin\importerJSON.php on line 79
Call Stack[/b]