Created
August 14, 2019 00:59
-
-
Save parzibyte/84cd3ba74a50b3f8960628dc1e3d2e23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>PHP Test</title> | |
</head> | |
<body> | |
<?php | |
# Tomada de https://stackoverflow.com/questions/1734250/what-is-the-equivalent-of-javascripts-encodeuricomponent-in-php | |
function encodeURIComponent($str) { | |
$revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')'); | |
return strtr(rawurlencode($str), $revert); | |
} | |
$mensaje = "Creando enlaces de WhatsApp desde PHP. https://parzibyte.me/blog"; | |
$enlace = "https://api.whatsapp.com/send?text=" . encodeURIComponent($mensaje); | |
?> | |
<a href="<?php echo $enlace ?>">Compartir</a> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment