I have a code in PHP that directs a mobile user to send a sms on the device.
This code works on all iphone and blackberry devices and most android however... It does not work on on my Sony Experia.
I identified the phone with the useragent 'linux' and it does work but the code to send the sms does not seem to pre populate the body it gives the following errors:
if using $shareiphone
it opens the message but instead of populating the body with my message it only populates with ;
else if using $shareandroid
it opens the message but instead of populating the body with my message it only populates with &
else if using $sharelinux
it opens the message but instead of populating the body with my message it only populates with //&
Sure there must be a simple fix.
$shareiphone = '</div> <a class="btnTop" href="sms:%20&body=%20https://www.myecard.biz/hans_fouche" name="clicked">Forward to phone</a>';
$shareandroid = '</div> <a class="btnTop" href="sms:%20&?body=%20https://www.myecard.biz/hans_fouche" name="clicke">Forward to phone</a>';
$sharelinux = '</div> <a class="btnTop" href="sms://%20&?body=%20https://www.myecard.biz/hans_fouche" name="clicke">Forward to phone</a>';
if( stristr($_SERVER['HTTP_USER_AGENT'],'linux') ) {
$device = "linux";
echo $sharelinux;
if (isset($_POST['clicked'])) {
counter_add();
}
}
else if( stristr($_SERVER['HTTP_USER_AGENT'],'ipad') || stristr($_SERVER['HTTP_USER_AGENT'],'iphone') || strstr($_SERVER['HTTP_USER_AGENT'],'iphone') ) {
$device = "ipad";
echo $shareiphone;
if (isset($_POST['clicked'])) {
counter_add();
}
}
else if( stristr($_SERVER['HTTP_USER_AGENT'],'blackberry') ) {
$device = "blackberry";
echo $shareiphone;
}
else if( stristr($_SERVER['HTTP_USER_AGENT'],'android') ) {
$device = "android";
echo $shareandroid;
}
else {
$device = "PC";
echo $sharelinux;
}