[Zope] Reading/Parsing HTML Files from another server

seb sebbacon@email.com
Thu, 28 Sep 2000 16:18:15 +0100


You could write a simple external method that uses httplib, e.g.

import httplib

def gethttp(self,url,file):
    h = httplib.HTTP(url)
    h.putrequest('GET', file)
    h.endheaders()
    errcode, errmsg, headers = h.getreply()
    if errcode == 200:
        f = h.getfile()
        response = f.read()
        f.close
    else:
        response = "oops."
    return response

and then:

<dtml-var "gethttp('www.zope.org','/')">

Seb.

> Hi,
> 
> I want to include a HTML file from another server (e.g.
> www.foo.com/include.html ) into the output of one of my DTML methods
> (index_html).
> 
> How can I do this?
>