How to Embed PHP in HTML print

NickC reply-to at works.fine.invalid
Sun Jan 24 08:59:46 EST 2010


On Sun, 24 Jan 2010 10:37:51 +0000, Duncan Booth wrote:

> content with ajax. Alternatively, use urllib in Python to retrieve a
> page from the Apache server and insert that into its own output: that

Thanks for hint on urllib.  I shake my head in amazement with python 
sometimes.  I'll write it here:

print urllib.urlopen('http://myserver.com/phpscript.php').read()

That's it.  *One* line.

The output from the php script is:
<a href='zenphoto/kitty/IMG_0759.jpg' title='Random Picture...'>
<img src='zenphoto/cache/kitty/IMG_0759_800.jpg'
alt="random image"
IMG_0759" /></a>

and the one-liner seamlessly prints that to insert it into the html output.

And I thought it would be hard; I should have known better.


-- 
NickC



More information about the Python-list mailing list