diff --git a/edit/edit.php b/edit/edit.php index 8c502c7..d1048ec 100755 --- a/edit/edit.php +++ b/edit/edit.php @@ -20,12 +20,13 @@ $msg = $_GET['msg']; $ie = $_GET['image_exist']; -$res = \lib\SensitiveWordDetection::send($title.$msg); +$res = \lib\SensitiveWordDetection::sendSwc($title.$msg); -if($res['status']='00000'){ - if($res['result']==true){ - $rr->send(-2,"您所发的内容包含敏感词汇!",$res); - } +if($res['status']=='00000'){ +// if($res['result']==true){ +// $rr->send(-2,"您所发的内容包含敏感词汇!",$res); +// } + $msg = $res['result']; }else{ $rr->send(-1,"网络错误,请稍后重试!",$res); } diff --git a/getopenid.php b/getopenid.php index bbc4bcc..4113cf2 100755 --- a/getopenid.php +++ b/getopenid.php @@ -2,7 +2,7 @@ $data = $_GET; //echo json_encode($data); $appid="wxd8d5a2f6fa7f1878"; - $appsecret="064157612113b2490b1941c7b0e77fda"; + $appsecret="001gjwq00HrkqH14SDs00PXMq00gjwq4"; $code=$_GET['code']; $get_url="https://api.weixin.qq.com/sns/jscode2session?appid=".$appid."&secret=".$appsecret."&js_code=".$code."&grant_type=authorization_code"; $get_return = file_get_contents($get_url); diff --git a/lib/SensitiveWordDetection.php b/lib/SensitiveWordDetection.php index 7860344..6479da4 100755 --- a/lib/SensitiveWordDetection.php +++ b/lib/SensitiveWordDetection.php @@ -22,9 +22,8 @@ public function __construct() $this->log = new \lib\Log(); } - public static function send($querys){ + public static function sendSwc($querys){ $host = "http://apistore.tongchengyue.com"; -// $path = "/sw/isContains"; $path = "/swc/doFilter"; $method = "POST"; $appcode = "f560138f1b514ca98e7cf8ca12a23d85"; @@ -56,4 +55,39 @@ public static function send($querys){ $resBody = json_decode($resBody,true); return $resBody; } + + public static function send($querys){ + $host = "http://apistore.tongchengyue.com"; + $path = "/sw/isContains"; +// $path = "/swc/doFilter"; + $method = "POST"; + $appcode = "f560138f1b514ca98e7cf8ca12a23d85"; + $headers = array(); + array_push($headers, "Authorization:APPCODE " . $appcode); + //根据API的要求,定义相对应的Content-Type + array_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8"); +// $querys = ""; + $bodys = "src=".$querys; + $url = $host . $path; + + $curl = curl_init(); + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + curl_setopt($curl, CURLOPT_FAILONERROR, false); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curl, CURLOPT_HEADER, true); + if (1 == strpos("$".$host, "https://")) + { + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); + } + curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys); + $response = curl_exec($curl); + if (curl_getinfo($curl, CURLINFO_HTTP_CODE) == '200') { + list($resHeader, $resBody) = explode("\r\n\r\n", $response, 2); + } + $resBody = json_decode($resBody,true); + return $resBody; + } } \ No newline at end of file