Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

including a page on a remote server

Status
Not open for further replies.

nuandaEB

Technical User
Oct 22, 2002
8
CA
I'd like to "embed" the contents of a page that's generated on a remote server. The page on the remote server is dynamically generated.
I would like to wrap my ASP page around the URL that represents the page on the remote server.

The result would be an ASP page on my serving comprised of my header and footer wrapped around the contents of the page on the remote server.

I tried the include directive, but without success.

Any help would be greatly appreciated.

Best regards,

EB
 
Make sure the inc file is in a shared directory and use the UNC to that file. Then use the file keyword.

<!--#include file=&quot;\\myserver\sharedfolder\myfile.inc&quot; -->
 
The problem with inclding the dynamic file is that you will not get it's content, you will get the script that creates the content. Therefore you would also need all of the files it depends on, as well as any databases, etc that it is talking to.

I believe you may have to resort to using the XMLHTTP object in order to grab th content of that remote page, parse out the portion of the content you wish to keep, then display your own content as well.

For example:
Code:
<%
Response.Buffer = True
'Dim objXMLHTTP, URL

' Create an xmlhttp object:
Set objXMLHTTP = Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)

URL = &quot;[URL unfurl="true"]http://www.google.com/&quot;[/URL]

' Opens the connection to the remote server.
objXMLHTTP.Open &quot;GET&quot;, URL, False

' Actually Sends the request and returns the data:
objXMLHTTP.Send

Dim content
content = objXMLHTTP.ResponseText

Dim begTag, endTag, begPos, endLen
begTag = &quot;<body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onLoad=sf()>&quot;
endTag = &quot;</body>&quot;

begPos = InStr(content,begTag)+len(begtag)
endLen = len(content) - InStr(content,endTag)

content = mid(content,begPos,len(content)-begPos-endlen)

Response.Write &quot;<html><body>my header is here&quot;
Response.Write content
Response.Write &quot;My footer is here</body></html>&quot;
%>

Basically this takes out everything betwen the two tags I specified and leaves everything else in the string. Then I can output anything I want both before and after the content I received and trimmed down from google.

Hope this helps,
-Tarwn

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
minilogo.gif alt=tiernok.com
The never-completed website
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top