文档详情

基于PHP和AJAX创建RSS聚合器(Create RSS aggregators based on PHP and AJAX).doc

发布:2017-07-18约1.09万字共14页下载文档
文本预览下载声明
基于PHP和AJAX创建RSS聚合器(Create RSS aggregators based on PHP and AJAX) Imagine using a simple HTML file to send a request to a server-side script, receive a custom XML documents based on the request, and then show it to the user and almost do not need to refresh your browser! This article will discuss how to combine PHP and AJAX technologies in common Web applications to create real-time data transfer without browser refresh. Although this article USES the PHP language, remember that any server-side language works. To understand this article, I assume that you have a basic understanding of JavaScript and PHP or a similar server-side language. This article USES AJAX to send a request from an RSS feed to a certain PHP object. The PHP object copies a copy of the feed on the local server and returns this path. The request object receives this path, analyzes it, and displays the data to the user in HTML form. This sounds like a lot of steps, but it consists of only four small files. Four small files are used to balance their specific forces and make the system efficient. Some readers may ask why you want to create a copy of a feed on a local server instead of simply analyzing the original feed. The reason for this is that this allows you to bypass the cross-domain restrictions imposed by the XML HTTP Request object. Later, Ill explain how to create this custom PHP object; But first, lets start with form creation. Create the form to issue the request The first thing you need to do is to include JavaScript and any CSS files that you might want to use between the head tags of your HTML. I included a style sheet to implement the final layout of the aggregator and use a JavaScript file to request and feed analysis: link href = CSS/layout.css rel = stylesheet type = text/CSS / script SRC = js/request. Js / script Next, create a form that sends the request to an RSS feed you select. The form I created includes only one input field and a button to submit the request. The query f
显示全部
相似文档