Execute php code in Python

后端 未结 5 2091
时光取名叫无心
时光取名叫无心 2020-11-27 16:30

For some reason, I have to run a php script to get an image from Python. Because the php script is very big and it is not mine, it will takes me days to find out the right a

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 17:14

    Make a wrapper around the PHP script, which:

    • performs the stuff (If I understand well, it's an image creation),
    • then redirects (301 Moved Permanently) to the result image,
    • (also, the image should be purged some day).

    So you can refer to this service (the PHP script) with a simple HTTP request, from anywhere, you can test it with browser, use from Python prg, you need just download the image the usual way.

    Also, if you have a such standalone sub-system, don't feel bad about implement it with different language/technique. It has several advantages, e.g. you can install that service on a different host.

    Recommended reading: Service-Oriented Architecture on Wikipedia.

提交回复
热议问题