Is there any way that you can include another website within your site using php? Example: I have 2 different domains and I want to load both of them at one time split screen on a third domain can this be done? and if so how?
Couldn't that just be done using iframes? <iframe src="http://site1.com" height="200"> </iframe> <iframe src="http://site2.com" height="200"> </iframe> Code (markup): Otherwise you could use the php include() function and include the specific file that you want to load from each domain.
Iframes are not a good idea to use, they are now deprecated in HTML 4.1 Strict DTD anyway. This is how you can do it with cURL in PHP: <?php $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "http://website.com"); curl_exec($curl); curl_close($curl); ?> Code (markup):
Curl will also break relative image urls if you try to use the above code. So you have to make them absolute too.
<iframe> methods are nice for getting around blocked server ports and disabled PHP functions/directives. Some servers will not allow HTTP include/require calls, you would need to try fsockopen or file_get_contents, provided that those functions aren't blocked from HTTP reading as well. cURL is probably the fastest server-based method from what I've seen of peoples benchmarks, but is a lot more complicated than include/require/file_get_contents because of the extra control it provides. Of course, there's always the chance these websites are on the same server in which case you should be able to include filesystem based paths to the pages instead of http:// based paths without many, if any, problems.
you cannot include remote webpages if allow_url_fopen is disabled so..curl is your best bet.. you can get the html contents of the remote website into a php string and can even display it inside a div layer.
Do u have any doubt abt it? i mean this: http://www.howtocreate.co.uk/tutorials/html/framesets I think he needs just that: