[Zope] 'including' output from external files in a DTML doc?

Rob Page rob.page@digicool.com
Fri, 21 May 1999 10:44:22 -0400


>  Anyone got any ideas on how to include output from external programs 
>  (in my case it will be Perl and PHP3) in a Zope document?

If I understand correctly you want to use http as a sorta-kinda RPC and
insert the results in your document.  Python's httplib gives you an http
client.  

Try an external method something like this:

<blatantly stolen from the Python library reference>

>>> import httplib
>>> h = httplib.HTTP('www.cwi.nl')
>>> h.putrequest('GET', '/index.html')
>>> h.putheader('Accept', 'text/html')
>>> h.putheader('Accept', 'text/plain')
>>> h.endheaders()
>>> errcode, errmsg, headers = h.getreply()
>>> print errcode # Should be 200
>>> f = h.getfile()
>>> data = f.read() # Get the raw HTML
>>> f.close()

</blatantly stolen from the Python library reference>

Of course, you'll get all the http headers as well so you'll probably
have to parse those out.

--Rob