As a general rule, there is no guaranteed way to get the PHP (or whatever) underlying a site. Your best bet is to figure out what software the site is running on, and then set up your own copy of that software. Then, leech the relevant graphics, stylesheets and content, and use that to make your clone.
As a general rule, though, rolling an exact clone is a bad idea. The big G is likely to penalize you, and there are plenty of places out there for someone to whine (loudly) about having been ripped. It is better, IMHO, to just identify a software package that already does most of the same stuff as the site you want to copy, and grab a template that looks nice and/or similar, and then focus on spinning the content. Outsource some or all of the process as needed, and at the end of the process you will have a knockoff site.
If you want a 100% automated process, you can certainly mirror a site, but replicating dynamic functionality will not work.