0

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&amp;body=%20https://www.myecard.biz/hans_fouche" name="clicked">Forward to phone</a>';
    $shareandroid = '</div> <a class="btnTop" href="sms:%20&amp?body=%20https://www.myecard.biz/hans_fouche" name="clicke">Forward to phone</a>';
    $sharelinux = '</div> <a class="btnTop" href="sms://%20&amp?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;

    }
j08691
  • 204,283
  • 31
  • 260
  • 272
Hans Fouche
  • 89
  • 1
  • 10
  • If you don't need this to be done on the server side, take a look at https://github.com/smeeckaert/sms-link – Luca Kiebel May 24 '17 at 20:07
  • Thanks, I have checked and it is same as what I have just a different method. I need a different code for the Sony Experia – Hans Fouche May 24 '17 at 20:18

1 Answers1

0

I search and researched and could not find this. I played with the code and thought the %20&amp might be the problem. I removed it and it now word perfectly.

Below is my code:

$sharelinux = '</div> <a class="btnTop" href="sms:?body=%20https://www.myecard.biz/BIRC/roelof_prinsloo" name="clicke">Forward to phone</a>';
Hans Fouche
  • 89
  • 1
  • 10