|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I need to be able to include some data (which is in a text file) from another server and display it on my webpage. I need to do this as this text file is updated, and I would like it to update my site at the same time. What is the best way of doing this? I have tried using a server side include and that did not work , so I guess it is not possible to do that. Has anyone got any ideas? Best Wishes G ![]() |
|
#2
|
||||
|
||||
|
Are you using a specific server side language?
Some languages have ways of accessing web documents (text, html, etc) via HTTP. If your other server is on the local network, and not a webserver, you can usually access the file with an absolute path. If nothign works, check that you have proper permissions to access the file. |
|
#3
|
|||
|
|||
|
Quote:
We have ISS on the server I am trying to pull the data from and too. I can use HTML, Javascript, VBScript or ASP to implement this, but I am not sure what is the best way of doing it. Both servers are web servers. I can read the file via a browser. |
|
#4
|
|||
|
|||
|
Hi, you can not use "include file" for pages on two different servers. Here is a simple solution with asp. Call getcontent.asp, to get the content of the page from other server. Then save it as a text file (content.txt). And include file content.txt in the page thaet you will display (display.asp). Also, you can read the contents of content.txt with file system object and then send it to the browser with response.write command.
Getcontent.asp <% Dim FSO, TextStream Dim url, strContent Dim objXMLHTTP, xml Set FSO = Server.CreateObject("Scripting.FileSystemObject") url = "http://my.otherserver.com/mytextfile.txt Set xml = Server.CreateObject("Microsoft.XMLHTTP") xml.Open "GET", url, False xml.Send strContent = xml.responseText Set xml = Nothing Set TextStream = FSO.OpenTextFile(Server.MapPath("content.txt"), 2, True) TextStream.Write(strContent) TextStream.Close Set TextStream = Nothing Set FSO = Nothing %> Display.asp <% ... ... %> <!-- #include file="content.txt"--> <% ... ... %> |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Web Development > Including External Web Content |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|