


Detailed explanation of xmlhttp component to obtain remote files and filter out target data
Detailed explanationxmlhttp component obtains remote file and filters out the target data
getfile.asp
<% ''利用xmlhttp组件获取远程文件保存到当前空间 ''此是网站建设中的一个实例,远程获取一个网页内容并筛选出相关的天气数据,当然可以跳过文件本地存储再获取数据 ''参考了xoyu的函数,在此感谢 fileurl="http://www.hbqx.gov.cn/other/tqyb/inc_city_hb.asp" dotloc=InStrRev(fileurl,".") filepath="thistest"&mid(fileurl,dotloc) ''建立同类型文件名 ''filepath="thistest.htm" call saveRemoteFile(filepath,fileurl) sub SaveRemoteFile(LocalFileName,RemoteFileUrl) dim Ads,Retrieval,GetRemoteData Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP") With Retrieval .Open "Get", RemoteFileUrl, False, "", "" .Send GetRemoteData = .ResponseBody '' GetDetail = .ResponseText ''对文本型文件可直接获取内容,但不能支持中文,不知道如何解决 End With Set Retrieval = Nothing ''RESPONSE.WRITE GetDetail Set Ads = Server.CreateObject("Adodb.Stream") ''生成对应文件 With Ads .Type = 1 .Open .Write GetRemoteData .SaveToFile server.MapPath(LocalFileName),2 .Cancel() .Close() End With Set Ads=nothing end sub ''以上完成远程存储文件,以下只适用于对文本型文件的操作www.knowsky.com set fso=server.createobject("scripting.filesystemobject") ''读取文件内容 set fileout=fso.opentextfile(server.mappath(filepath),1) content=fileout.readall set fileout=nothing set fso=nothing ''response.write content contentarr=split(content,"<td") ''根据内容进行筛选 for i=1 to ubound(contentarr) if instr(contentarr(i),"恩施") then thisloc=i next dim xu(5) for j=0 to 4 con1=contentarr(thisloc+j) start1=instr(con1,">") con1=right(con1,len(con1)-start1) stop1=instr(con1,"<") con1=left(con1,stop1-1) str=str&contentarr(thisloc+j) xu(j)=trim(con1) next if xu(1)<>"" then response.write "document.write('恩施州未来24小时天气预报:"&xu(1)&",最低温度"&xu(2)&"摄氏度,最高温度"&xu(3)&"摄氏度,风向:"&xu(4)&".--武汉中心气象台发布');" else response.write "document.write('暂未发布');" end if ''response.write server.htmlencode(str) %>
In another htm pageQuoteShow the content obtained
<script src="getfile.asp"></script>
The above is the detailed content of Detailed explanation of xmlhttp component to obtain remote files and filter out target data. For more information, please follow other related articles on the PHP Chinese website!

The implementation of RSS in XML is to organize content through a structured XML format. 1) RSS uses XML as the data exchange format, including elements such as channel information and project list. 2) When generating RSS files, content must be organized according to specifications and published to the server for subscription. 3) RSS files can be subscribed through a reader or plug-in to automatically update the content.

Advanced features of RSS include content namespaces, extension modules, and conditional subscriptions. 1) Content namespace extends RSS functionality, 2) Extended modules such as DublinCore or iTunes to add metadata, 3) Conditional subscription filters entries based on specific conditions. These functions are implemented by adding XML elements and attributes to improve information acquisition efficiency.

RSSfeedsuseXMLtostructurecontentupdates.1)XMLprovidesahierarchicalstructurefordata.2)Theelementdefinesthefeed'sidentityandcontainselements.3)elementsrepresentindividualcontentpieces.4)RSSisextensible,allowingcustomelements.5)Bestpracticesincludeusing

RSS and XML are tools for web content management. RSS is used to publish and subscribe to content, and XML is used to store and transfer data. They work with content publishing, subscriptions, and update push. Examples of usage include RSS publishing blog posts and XML storing book information.

RSS documents are XML-based structured files used to publish and subscribe to frequently updated content. Its main functions include: 1) automated content updates, 2) content aggregation, and 3) improving browsing efficiency. Through RSSfeed, users can subscribe and get the latest information from different sources in a timely manner.

The XML structure of RSS includes: 1. XML declaration and RSS version, 2. Channel (Channel), 3. Item. These parts form the basis of RSS files, allowing users to obtain and process content information by parsing XML data.

RSSfeedsuseXMLtosyndicatecontent;parsingtheminvolvesloadingXML,navigatingitsstructure,andextractingdata.Applicationsincludebuildingnewsaggregatorsandtrackingpodcastepisodes.

RSS documents work by publishing content updates through XML files, and users subscribe and receive notifications through RSS readers. 1. Content publisher creates and updates RSS documents. 2. The RSS reader regularly accesses and parses XML files. 3. Users browse and read updated content. Example of usage: Subscribe to TechCrunch's RSS feed, just copy the link to the RSS reader.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.