简体   繁体   English

通过PHP / HTML链接的短信

[英]SMS through PHP/HTML link

I have a code in PHP that directs a mobile user to send a sms on the device. 我在PHP中有一个代码,指导移动用户在设备上发送短信。

This code works on all iphone and blackberry devices and most android however... It does not work on on my Sony Experia. 该代码可在所有iPhone和Blackberry设备以及大多数android系统上使用,但是...在我的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: 我用useragent'linux'识别了手机,它确实可以工作,但是发送短信的代码似乎并未预先填充机身,因此出现以下错误:

if using $shareiphone it opens the message but instead of populating the body with my message it only populates with ; 如果使用$shareiphone它将打开消息,但不会用我的消息填充正文,而只会用;填充;

else if using $shareandroid it opens the message but instead of populating the body with my message it only populates with & 否则,如果使用$shareandroid它将打开该消息,但不使用我的消息填充正文,而是仅使用&填充

else if using $sharelinux it opens the message but instead of populating the body with my message it only populates with //& 否则,如果使用$sharelinux它将打开该消息,但不会使用我的消息填充正文,而是仅使用//&

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;

    }

I search and researched and could not find this. 我进行了搜索和研究,但找不到。 I played with the code and thought the %20&amp might be the problem. 我玩过代码,并认为%20&amp可能是问题所在。 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>';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM