Exec () PHP函数不工作


exec () php function not working

<?php
    error_reporting(0);
    session_start();
    function code($no_of_char)
        {
            $code='';
            $possible_char="0123456789";
            while($no_of_char>0)
                {
                    $code.=substr($possible_char, rand(0, strlen($possible_char)-1), 1);
                    $no_of_char--;
                }
            return $code;
        }
        function sendSms($msg, $to)
        {
        $to=trim($to);
        $m.=urlencode($msg);
   $smsurl="http://bhashsms.com/api/sendmsg.php?user=*****&pass=*****&sender=******&phone=$to&text=$m&priority=ndnd&stype=normal";
    $return = exec($smsurl);
        return $return;
        }
    ?>

print_r($smsurl)显示我想要的绝对正确的命令,但不执行exec($smsurl)我对exec()函数不太熟悉。

exec用于执行外部程序,但从web url访问某些网页/api不是exec的有效用例。如果您想从Url获取数据,请尝试此操作。

如何在php中调用任何其他网站的url