i am trying to fetch a mail in imap from google, i'm using the imap() function from PHP IMAP library and i want to use a preg_match() call on my mail content but i have a strange issue, i have curious break lines altering the normal preg_match().
More details:
I have in my markup something like that:
Résumé points de classement | Extérieur | Domicile |
Équipe | Milan | Arsenal |
Performance du match | 0 | 19 |
Étoiles équipe | 0 | 0 |
Points totaux | 3195 | 3273 |
Niveau actuel | 22 | 22 |
Points pour le prochain niveau | 5 | 127 |
I am running this code to extract the body for example:
The output of this code is:
string '
<TABLE' (length=13)
string '
<TABLE' (length=13)
And the extracted value is an empty array... After further investigation i discovered through a var_dump() of my source string that there is a
at the end of each line.
I have no clue of what this html char code is and how to remove it.
If you can enlight me, i'll be thankfull ;)
Have a nice day!
EDIT:
With a str_replace() it works!
is in fact the \n break line. So the magic tricks is:
$overview = imap_body($inbox,$email_number,0);
$message = utf8_decode(quoted_printable_decode($overview));
$message = str_replace("\n", "", $message);