全国服务热线:4008-888-888

行业新闻

企业网站建设专业-微信接口完整代码php版

--------

企业网站建设专业

------- 作者:宁波企业网站建设——三乐设计方案 公布時间:2013⑿-04 阅读文章次数:5258 【关掉本页】
  $qry = mysql_query("SET NAMES 'utf8'") or startUpError('.SET NAMES Error.');   $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
      //extract post data   if (!empty($postStr)){                                $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);                 $fromUsername = $postObj- FromUserName;                 $toUsername = $postObj- ToUserName;                 $keyword = trim($postObj- Content);     $RX_TYPE = trim($postObj- MsgType);                 $time = time();                 $textTpl = " xml         ToUserName ![CDATA[%s]] /ToUserName         FromUserName ![CDATA[%s]] /FromUserName         CreateTime %s /CreateTime         MsgType ![CDATA[text]] /MsgType         Content ![CDATA[%s]] /Content         FuncFlag 0 /FuncFlag         /xml     $textgz=" xml             ToUserName ![CDATA[%s]] /ToUserName         FromUserName ![CDATA[%s]] /FromUserName             CreateTime %s /CreateTime         MsgType ![CDATA[news]] /MsgType                             ArticleCount 2 /ArticleCount                             Articles                             item                             Title ![CDATA[%s]] /Title                             Description ![CDATA[%s]] /Description                             PicUrl ![CDATA[%s]] /PicUrl                             Url ![CDATA[%s]] /Url                             /item                             item                             Title ![CDATA[%s]] /Title                             Description ![CDATA[%s]] /Description                             PicUrl ![CDATA[%s]] /PicUrl                             Url ![CDATA[%s]] /Url                             /item                             /Articles                             /xml     $textnews_top=" xml             ToUserName ![CDATA[%s]] /ToUserName         FromUserName ![CDATA[%s]] /FromUserName             CreateTime %s /CreateTime         MsgType ![CDATA[news]] /MsgType                             ArticleCount %s /ArticleCount                             Articles     $textnews_con=" item                             Title ![CDATA[%s]] /Title                             Description ![CDATA[%s]] /Description                             PicUrl ![CDATA[%s]] /PicUrl                             Url ![CDATA[%s]] /Url                             /item     $textnews_bot=" /Articles                             /xml     if($RX_TYPE=="event"){      if ($postObj- Event=="subscribe"){     $zhf_sql="select * from wx where wx_lx='1' and wx_publish='0' order by tuijian_paixu asc,wx_update asc limit 0,10";     $result_show=mysql_query($zhf_sql,$conn);     $result_top = sprintf($textnews_top, $fromUsername, $toUsername, $time,mysql_num_rows($result_show));         while ($obj_show=mysql_fetch_assoc($result_show)){     $result_con.=sprintf($textnews_con,$obj_show["wx_title"],$obj_show["wx_con"],"/images/pic/lb/".$obj_show["wx_pic"],$obj_show["wx_link"]);     }                  echo $result_top.$result_con.$textnews_bot;      }     } else {           $zhf_sql="select * from wx where wx_lx!='1' and wx_publish='0' and FIND_IN_SET('".$keyword."',wx_key) and wx_hfid='0' order by tuijian_paixu asc,wx_update asc";     $result_show=mysql_query($zhf_sql,$conn);     if (mysql_num_rows($result_show)=="0"){      $zhf_sql="select * from wx where wx_lx!='1' and wx_publish='0'  and wx_hfid='0' and wx_key='默认设置回应' order by tuijian_paixu asc,wx_update asc";     $result_show=mysql_query($zhf_sql,$conn);     }     if ($obj_show=mysql_fetch_assoc($result_show)){     switch ($obj_show["wx_lx"]){       case "3":       $result_con_show=sprintf($textnews_con,str_replace(" BR ","\n",$obj_show["wx_title"]),str_replace(" BR ","\n",$obj_show["wx_con"]),"/images/pic/lb/".$obj_show["wx_pic"],$obj_show["wx_link"]);         $result_top = sprintf($textnews_top, $fromUsername, $toUsername, $time,"1");     echo $result_top.$result_con_show.$textnews_bot;       break;       case "4":       $result_con_show=sprintf($textnews_con,$obj_show["wx_title"],$obj_show["wx_con"],"images/pic/lb/".$obj_show["wx_pic"],$obj_show["wx_link"]);     $hf_sql="select * from wx where wx_lx!='1' and wx_publish='0'  and wx_hfid='".$obj_show["wx_id"]."' order by tuijian_paixu asc,wx_update asc limit 0,10";                 $result_hf=mysql_query($hf_sql,$conn);     $hf_sl=mysql_num_rows($result_hf)+1;     $result_top = sprintf($textnews_top, $fromUsername, $toUsername, $time,$hf_sl);     while ($obj_hf=mysql_fetch_assoc($result_hf)){     $result_con_show.=sprintf($textnews_con,str_replace(" BR ","\n",$obj_hf["wx_title"]),$obj_hf["wx_con"],"/images/pic/lb/".$obj_hf["wx_pic"],$obj_hf["wx_link"]);     }     echo $result_top.$result_con_show.$textnews_bot;       break;     case "2":       $resultStr4 = sprintf($textTpl, $fromUsername, $toUsername, $time, str_replace(" BR ","\n",$obj_show["wx_con"]));       echo $resultStr4;     break;     }         }                      //echo $result_top.$result_con.$textnews_bot;         }         }else {          echo "";          exit;         }     }    private function checkSignature()  {         $signature = $_GET["signature"];         $timestamp = $_GET["timestamp"];         $nonce = $_GET["nonce"];             $token = TOKEN;   $tmpArr = array($token, $timestamp, $nonce);   sort($tmpArr);   $tmpStr = implode( $tmpArr );   $tmpStr = sha1( $tmpStr );     if( $tmpStr == $signature ){    return true;   }else{    return false;   }  }

此作用包含:关心全自动回应,文字回应,单照片回应,多照片回应,重要词默认设置回应
---------

企业网站建设专业

------------


在线客服

关闭

客户服务热线
4008-888-888


点击这里给我发消息 在线客服

点击这里给我发消息 在线客服