Scripting: HTTP GET?

started by Terakris on Sep 7, 2004 — RSS Feed

Terakris Terakris
Posts: 23

Hi people,

I'm trying to access a page on another server and include it in my page, much like a server side include (im using ASP). Ive been given this sample that works in ColdFusion apparently, but wondered if anyone had a similar solution for ASP?

<!-- HTTP include theUrl -->
<CFHTTP method="GET" url="#theUrl#" resolveurl="Yes">
<cfoutput>
#CFHTTP.FileContent#
</cfoutput>
</CFHTTP>

The page is on a remote server (web site), not on our domain so we cant access it via local paths so has to be by HTTP. Any help would be appreciated.

Thanks in advance

Kris

Asrar Asrar
Posts: 2

R&D Microsoft's XMLHTTP

Server.CreateObject("Microsoft.XMLHTTP"

Stuartm Stuartm
Posts: 6

The code for an ASP include looks like this:

<!--#include file="http://www.yoursite.com/yourfile.asp"-->

Just substitute the URL for the URL of your include and that should work just fine.

Stu

Baxter Baxter
Posts: 157

However, includes in general don't always work across different servers.

Also, you should be aware that what you're doing is pretty dangerous. First, your code will be jacked up, because you're bringing in their code (which probably includes their head, body, script, css and whatever other tags you probably don't want). Even worse, you're at the whim of that webmaster... if there's ever anything bad on their page, or if it's ever compromised, now that's on yours, too. Worst case, a virus gets on thier page. Now you've got it on yours.

You must login to reply