2013-04-15 81 views
0

我尝试在我们的手机号码确认短信警报发布后注册我们的产品的PHP编码....在使用way2短信手机网站..它似乎出现了一些错误....php短信代码错误

消息已发送你的邮件地址登录... 注意:未定义的偏移量:1在C:\ wamp \ www \ html \ class.sms.php上线126 发送短消息... 注意:Undefined offset: 1在C:\瓦帕\ WWW \ HTML \ class.sms.php上线遇到147 错误:

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 
     } 

回答

0

消息看起来prett y对我清楚:$matches[1]在位置1没有元素。 尝试打印您的$matches阵列这样,你会看到你有什么:

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

看起来像你的正则表达式是不返回任何导致$matches

+0

哥们我引起一个错误:注意:未定义偏移量:1在C:\ wamp \ www \ html \ class.sms.php上线126 发送SMS ... Array()遇到错误: – user2224148

+0

看起来像你的' $ pattern'在'$ out'字符串中找不到'$ matches'。你能打印它们并将它们粘贴到评论中吗? –