Exchange php whatsapp not sending the whole link

I am trying to pass the whole link through whatsapp . Suppose I have a link in my browser like:

 http://www.foo.com/foo?a=1&b=2 

My usual way to share the link I used:

 $actual_link="http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; echo "<li><a href='whatsapp://send?text=$actual_link'>Share</a></li>"; 

When I hover over the anchor element, it shows the link correctly, but when I click on it and get into whatsapp, the message appears as:

 http://www.foo.com/foo?a=1 

Why am I not getting the second variable?

+4
source share
1 answer

I myself tested this on my Mac using the WhatsApp desktop app, and the URL is correctly passed to WhatsApp:

 <?php $actual_link = urlencode("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); echo "<li><a href='whatsapp://send?text=$actual_link'>Share</a></li>"; ?> 

So, if I go to the URL below and click on the sharing link, then this is exactly what I see in WhatsApp

 http://localhost/whatsapp.php?a=1&b=2 
0
source

All Articles