Programatically obtaining a Profile's HTML Snippet
Take a look at CRM_UF_Page_Group::profile().

You want to do that except instead of passing gid (the profile id) through the url you'd make it a function parameter, and then what you want is the value of the $profile variable.