How to Embed PHP in HTML print
Steve Holden
steve at holdenweb.com
Sun Jan 24 18:07:46 EST 2010
NickC wrote:
> 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.
>
>
Always great to see Python doing impressive things for new users.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/
More information about the Python-list
mailing list