Before passing $code through eval(), mentions of $URL in the string need to be replaced with the actual, quoted URL.