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().
I have in my markup something like that:
I am running this code to extract the body for example:
The output of this code is:
|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 |
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!
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);