Google Answers Logo
View Question
 
Q: Call a page from other website ( No Answer,   2 Comments )
Question  
Subject: Call a page from other website
Category: Computers > Programming
Asked by: rahuljalan-ga
List Price: $12.00
Posted: 15 Mar 2005 08:25 PST
Expires: 14 Apr 2005 09:25 PDT
Question ID: 495038
Dear Reasearchers,

I am having a network of 46 portals, all hosted on the same server.
Please see www.indiaeducation.info , and the links to other portals
are provided there.

Now all my main webpages are on www.indiaeducation.info and I want to
call these on my other portals.

Now suppose if I make a page "xyz.asp" and it lies in
"www.otherwebsite.com", how shall i call "abc.asp" which lies in
www.indiaeducation.info into "xyz.asp".

My purpose of doing this is to make the user feel that he is still on
the same site he entered. Right now I am doing it by using frames. I
don't want to use the frames and also the "include file/virtual" thing
is not working.

Is there a way out? Can you suggest some scripting or codes through
which this is possible?
Answer  
There is no answer at this time.

Comments  
Subject: Re: Call a page from other website
From: willcodeforfood-ga on 15 Mar 2005 15:53 PST
 
Until and unless someone else can find you a more suitable solutions,
here's my two cents worth.

One way would be to fetch the pages from your server and them embed
them into your HTML.  This method has some drawbacks which I have
listed below.  It is essentially the very first step in making a
content management system.  If you control all of the sites that feel
these portals, I'd consider a real content management system.  Some
can be found for very cheap or even for free.

The obvious problems with fetching HTML from other sites and embedding
it it in your pages are:

1. Cookies will not work without some tricky manipulation since your server is 
   always requesting pages, not the client's browser.
2. You will need a page caching mechanism to avoid needless URL retrieval.
3. Your main page will have multiple <html> and <body> tags.  I checked and this
   is okay for IE 6.0, but may not work on other browsers.  If not, you'll need
   to strip out those tags after you fetch the URL.
4. Some JavaScript from sites outside of your control will likely not work.
5. All relative images and links will be broken.  Only fully-qualified image
   and link URLs will work in the pages that you embed this way.  Linked
   stylesheets and script files will also be broken unless their URLs are fully
   qualified.

A page utilizing this approach would look something like this:

<%
' this is the source for http://www.otherwebsite.com/xyz.asp
%>

<html>

<head>
</head>

<body>

  <table>

    <tr>
      <td><%= GetHtmlPageSource("www.indiaeducation.info/abc.asp") %></td>
      <td><%= GetHtmlPageSource("www.indiaeducation.info/another.asp") %></td>
    </tr>

    <tr>
      <td><%= GetHtmlPageSource("www.othersite.gov/info.html") %></td>
      <td><%= GetHtmlPageSource("www.anothersite.com/somepage.htm") %></td>
    </tr>

  </table>

</body>

</html>

<%

Function GetHtmlPageSource(ByVal URL As String)
    ' function courtesy of http://www.devx.com/vb2themax/Tip/19342

    Dim objHTTP  As New XMLHTTP

    ' add the http:// in case it isn't already present in the specified URL
    If Left$(URL, 7) <> "http://" Then URL = "http://" & URL    

    ' open the page in sync mode
    objHTTP.open "GET", URL, False
    objHTTP.send

    ' check the result of the operation
    If objHTTP.Status = "200" Then
        GetHtmlPageSource = objHTTP.responseText
    End If

End Function

%>
Subject: Re: Call a page from other website
From: ullfindsmit-ga on 18 Mar 2005 22:10 PST
 
Use the WinHttp.WinHttpRequest.5 OBJECT.

http://blog.omegasoftinc.com/index.php?p=8

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy