GmrBrian
require_once \'apiAccess_token.php\';
        //require_once  \'apiOpenid.php\';
        require_once \'../../includes/config.inc.php\';
        header(\'Content-Type: text/html; charset=utf-8\');
        error_reporting(0);
        if(!empty($access_token)){
                $sql = "select openid from `weiuser` ";
                $openid = $mysqli->get($sql) ;
                echo "<pre>";
                $num =ceil(count($openid));
                $sql = "insert into `weijilu`(\'worker\',\'opercode\',\'openid\',\'time\',\'text\')";
                for($i=0;$i<$num;$i++){
                        $openid1 = $openid[$i][\'openid\'];
                        
                        $url="https://api.weixin.qq.com/cgi-bin/customservice/getrecord?access_token=$access_token";                
                        $arr=array(
                                        
                                        "starttime" =>123456789,
                                        "endtime" => 987654321,
                                        "openid" => "$openid1",
                                        "pagesize" => 10,
                                        "pageindex" => 1,
                                        );
                        
                        $json = json_encode($arr);
                        p($url);
                        p($arr);
                        p($json);
                        $ch = curl_init();
                        curl_setopt($ch, CURLOPT_URL, $url);
                        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
                        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
                        curl_setopt($ch, CURLOPT_POST, 1);
                        curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                        $output = curl_exec($ch);
                        curl_close($ch);
                        $jsoninfo = json_decode($output, true);
                        $worker = $jsoninfo[\'recordlist\'][\'worker\'];
                        $opercode = $jsoninfo[\'recordlist\'][\'opercode\'];
                        $time = $jsoninfo[\'recordlist\'][\'time\'];
                        $text = $jsoninfo[\'recordlist\'][\'text\'];
                        
                        p($output);
                        
                        
                        if(!empty($worker) && !empty($opercode) && !empty($time) && !empty($text)){
                                echo 111;
                                $sql.="value(\'".$worker."\',\'".$opercode."\',\'".$openid1."\',\'".$time."\',\'".$text."\')";
                        }else{
                                echo  "暂时没有聊天记录";
                                return false;
                        }
                }
                        $mysqli -> execute($sql);
        }

  

分类:

技术点:

相关文章:

  • 2021-11-23
  • 2021-11-27
  • 2021-12-31
  • 2021-09-08
  • 2021-11-18
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
猜你喜欢
  • 2021-09-24
  • 2021-06-25
  • 2021-08-26
  • 2021-12-31
  • 2021-06-20
  • 2021-08-29
相关资源
相似解决方案