php短信代码错误

时间:2013-04-15 12:58:14

标签: php cakephp

在我们的手机号码确认短信提醒后,我尝试使用php编码注册我们的产品....在使用way2短信移动网站..似乎发生了一些错误....

消息已发送您的电子邮件地址登录... 注意:未定义的偏移量:在第126行的C:\ wamp \ www \ html \ class.sms.php中为1 发送短信... 注意:未定义的偏移量:第147行的C:\ wamp \ www \ html \ class.sms.php中为1 遇到错误:

class.sms.php :


preg_match($pattern,$out,$matches);
        $id=trim($matches[1]);     // 126 line
        $this->data['id']=$id;

    }

    private function send_160by2($number,$msg)
    {
        $msg=urlencode($msg);
        $id=$this->data['id'];
        $out1=$this->curl->post("http://m.160by2.com/...Compose.asp?l=1","txt_mobileno=$number&txt_msg=$msg&cmdSend=Send+SMS&TID=&T_MsgId=&Msg=$id");
        //echo $out1;
        $pattern = '/\<table.+?\>(.+)\<\/table/s';
        preg_match($pattern, $out1, $matches);

        $out=strip_tags(@$matches[1]);
        if(count($matches)<1)
        {
        $pattern="/\<div.+?background:.+?yellow.+?\>(.+?)\<\/div\>/s";

        preg_match($pattern,$out1,$matches);

        $out=strip_tags($matches[1]);           // 147 line 
        }

1 个答案:

答案 0 :(得分:0)

该消息对我来说非常清楚:$matches[1]1位置没有元素。 尝试打印这样的$matches数组,你会看到你拥有的内容:

preg_match($pattern,$out,$matches);
print_r($matches);

您的RegEx似乎未返回任何结果$matches