I agree with Yusuf.
As your probably did not advanced your progress to much so far, I recommend you get yourself fully aware of the problems of the self-modifying code, see this:
http://en.wikipedia.org/wiki/Self-modifying_code#Disadvantages[
^].
At the same time, your idea is easy to implement using very different and much more robust approach. You should not use self-modification but certainly modification (or generation) of the code. You simply need an extra tier (possibly on the same computer, it depends on you payload) as your HTTP server. A key here is automatic notification of your other site.
Want to try (for great $ of course :-))?
—SA