Machine learning (ML) is implementing artificial intelligence (AI) research within medicine that has made dramatic progress in recent years. In addition to standard treatments, the role of complementary and alternative medicine should be mentioned. Traditional Thai medicine has received growing acceptance as a complementary approach to modern medicine by using local herbs. A vast amount of Thai herbal knowledge and information is freely available on the Internet. The reader must evaluate each website and decide to use trustworthy and appropriate information. This study aimed to acquire Thai herbal knowledge recorded in the Thai language system on the Internet by scraping websites using programming techniques. The knowledge was extracted with programming, and the types of Thai herbs were classified corresponding to target symptoms by the machine learning algorithm. The ML method organized the process when sufficient achievement was reached in order to give reliable and high accuracy results from the training data set. The validation of extracted knowledge was achieved by using the part-of-speech tag patterns analysis. This study showed that the programming and machine learning system was appropriate for obtaining and classifying Thai herbal medicines knowledge.