Is there a way to generate an HTML file using a PHP script which has an SVG embedded where the SVG itself is dynamically generated by the PHP script?

Basically, I want to display a dynamically generated SVG image to a client but <embed>, <object> as well as <iframe> only refer to external sources while PHP generates the current HTML page only (and not the external sources)

Further, is there a Javascript solution possible where I add SVG elements in the current DOM one by one?

Comments

Please explain the downvote. I am badly stuck in a project and if this is a duplicate, I would love to find the solution.

Written by Crimson

Really not sure why this was downvoted

Written by Neil Aitken

Accepted Answer

Try linking to your php file like this: <object href=svg_generator.php> <!-- other attributes necessary for embedding svg not listed here -->

Written by RommeDeSerieux
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki