💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
| 请求类型 | 请求地址 | | --- | --- | | POST | http://send.6web.cn/api/Check/words| | 参数名 | 类型 | 描述 | | --- | --- | --- | | user| String | 平台用户名 | | key| String | 平台用户密码 | | content| String | 查询的内容 | ``` 请求失败 -> 返回码 { "code": "0", "msg": "错误信息", } ``` ~~~ 合规 -> 返回码 { "code": "1", "msg": "无违禁词", } ``` ~~~ ``` 违规 -> 返回码 { "code": "2", "msg": "违禁词、违禁词", } ``` ~~~ 参照代码(PHP) ~~~ ~~~ <?php $url =http:// send.6web.cn/api/Check/words'; $content= '查询的内容'; $postdata = [ 'user' =>'平台用户名', 'key' => '平台用户密码', 'content' => $content ]; $result = request_post($url,$postdata); $status = json_decode($result,true); if($status['code'] == '2'){ //含有违禁词,参考返回的msg }else($status['code'] == '1'){ //无违禁词 }else{ //请求失败,参考返回的msg } function request_post($url = '', $post_data =0) { if (empty($url) || empty($post_data)) { return false; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $httpheader[] = "Accept:*/*"; $httpheader[] = "Accept-Encoding:gzip,deflate,sdch"; $httpheader[] = "Accept-Language:zh-CN,zh;q=0.8"; $httpheader[] = "Connection:close"; curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); if ($post_data) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); } curl_setopt($ch, CURLOPT_ENCODING, "gzip"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $ret = curl_exec($ch); curl_close($ch); return $ret; } ~~~ ~~~ 参照代码(JAVA) ~~~ ~~~ import java.io.*; import java.net.*; import java.util.*; public class Main { public static void main(String[] args) { String url = "http://send.6web.cn/api/Check/words"; String content = "查询的内容"; Map<String, String> postdata = new HashMap<String, String>(); postdata.put("user", "平台用户名"); postdata.put("key", "平台用户密码"); postdata.put("content", content); String result = requestPost(url, postdata); Map<String, Object> status = new HashMap<String, Object>(); try { status = new ObjectMapper().readValue(result, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { e.printStackTrace(); } if (status.get("code").equals("2")) { // 含有违禁词,参考返回的msg } else if (status.get("code").equals("1")) { // 无违禁词 } else { // 请求失败,参考返回的msg } } private static String requestPost(String url, Map<String, String> postdata) { StringBuilder result = new StringBuilder(); HttpURLConnection conn = null; OutputStreamWriter osw = null; BufferedReader br = null; try { URL realUrl = new URL(url); conn = (HttpURLConnection) realUrl.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Charset", "utf-8"); conn.setUseCaches(false); conn.setDoOutput(true); conn.setDoInput(true); conn.setConnectTimeout(30000); conn.setReadTimeout(30000); if (postdata != null && !postdata.isEmpty()) { osw = new OutputStreamWriter(conn.getOutputStream()); StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> entry : postdata.entrySet()) { sb.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue(), "utf-8")) .append("&"); } String param = sb.toString(); param = param.substring(0, param.length() - 1); osw.write(param); osw.flush(); } br = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line = ""; while ((line = br.readLine()) != null) { result.append(line); } } catch (Exception e) { e.printStackTrace(); } finally { try { if (osw != null) { osw.close(); } if (br != null) { br.close(); } } catch (IOException e) { e.printStackTrace(); } if (conn != null) { conn.disconnect(); } } return result.toString(); } }