0

My code generates a message that I get them with file_get_contents. However, this message can be, eventually, have accents in some words, like á, ã, ç...

The PHP change this accented characters to special characters, like a ç. Ok, this not cause some problem.

However, the whatsapp dont read &cedil, for example and this message will be truncate.

How I change the codes like $ccedil; for ç in a PHP variable on by fast way?


$fim = file_get_contents($pedidoaux);

header("Location: http://api.whatsapp.com/send?1=pt_BR&phone=WHATSAPPNUMBER&text=$fim");

MJFM apps
  • 5
  • 3

1 Answers1

1

URLs can only contain ASCII characters. For anything else, you need to encode them. Use urlencode().

header("Location: http://api.whatsapp.com/send?1=pt_BR&phone=WHATSAPPNUMBER&text=" . urlencode($fim));
Barmar
  • 741,623
  • 53
  • 500
  • 612