The two big problems with using include() and require() over HTTP are...
1) If you use a .php extension, they'll be parsed by PHP first, and you'll only get the HTML output.
2) You're opening up a potential security hole, if theres a router or something else inbetween you ( and there is ) then someone could potentially change the code you're including and execute any arbitrary code they wanted to on your server.
I would reccomend keeping seperate copies of all code for both sites.
Alternatively, something like XML-RPC or SOAP might solve your problems.
If you want to establish a connection to a database on a remote host, you'll need to specify the hostname you want to connect to, and have permission from the remot ehost to do so. See the MySQL manual and here: www.php.net/mysql_connect