Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to filter out sensitive words such as advertisements by php

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "php how to filter out advertisements and other related sensitive words". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "php how to filter out advertisements and other related sensitive words".

At present, the Internet is still very chaotic, especially full of all kinds of content related to * *, * *, * *. Obviously, this is not in line with the laws of our country, so in order for a product to live healthily and for a long time, it is best to use certain strategies to filter or remind users not to post this kind of content. However, it is easier said than done, and it is difficult to implement. The easiest way is to call off-the-shelf APIs, taking php as an example:

Obviously this method is very simple, and if you don't like php, you can also use other languages, take python as an example:

#-*-coding: utf-8-*-# flake8: noqa__author__ = 'wukong'import urllibfrom urllib import urlencode# configure the appKey and openIdapp_key= you applied for "*" open_id= "* *" request_url request address params request parameters method request method "def request_content (request_url,params)" Method): params = urlencode (params) if method and method.lower () = "get": F = urllib.urlopen ("% slots% s"% (request_url, params)) else: F = urllib.urlopen (request_url, params) content = f.read () print content def main (): domain= "http://api.xiaocongjisuan.com/"; Servlet= "data/taboo/recognize" method= "get" request_url=domain+servlet # dictionary params = {} params ["appKey"] = app_key params ["openId"] = open_id # variable part params ["content"] = "Please don't leave your QQ to find your sexual partner" params ["type"] = "ad" request_content (request_url,params Method) if _ _ name__ = ='_ _ main__': main () Thank you for your reading The above is the content of "how to filter out advertising and other related sensitive words by php". After the study of this article, I believe you have a deeper understanding of how php can filter out advertising and other related sensitive words, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report