How do I include a PHP script in Python?

后端 未结 5 2221
暗喜
暗喜 2021-02-09 05:56

I have a PHP script (news-generator.php) which, when I include it, grabs a bunch of news items and prints them. Right now, I\'m using Python for my website (CGI). When I was usi

5条回答
  •  走了就别回头了
    2021-02-09 06:21

    You could use urllib to get the page from the server (localhost) and execute it in the right environment for php. Not pretty, but it'll work. It may cause performance problems if you do it a lot.

提交回复
热议问题