djs1 Posted July 15, 2013 Share Posted July 15, 2013 Hello, I'm working on a project where I would like to load the contents of one webpage (that I'm not hosting) into a webpage that I am hosting with the ability to access the DOM of the non-hosted page. What I would like to do is load a different page (GUI for an internal system) within my own webpage, and then be able to select elements within the GUI using jQuery and add CSS styling to them. I figured iframes would be the easiest way to handle this, but then learned about the Same Origin Policy, which denies access to the DOM of a non-hosted page in the iframe. So then I tried using a PHP Include statement to load the GUI within my page. I've run in to 2 roadblocks with this method: The first is that when I tested this method using google.com as the included site, as soon as you click on a link, it takes you outside of my site and on to google. I'll definitely need the ability for users to click around within the GUI but still remain within my site. The 2nd issue I'm having is simply including the GUI since it's web address is an IP Address. I keep getting the following error: Warning: include() [function.include]: Failed opening 'http://192.168.1.xx' for inclusion (include_path='.:/usr/local/lib/php') in /home1/public_html/example.com/example.php. If anyone has any advice as to whether it's possible to acheive this, I'd love to hear some feedback. Maybe PHP isn't even the answer. Maybe I'm going about this all wrong. I'm definitely open to any suggestions at this point! Thanks for reading, DJS Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted July 15, 2013 Share Posted July 15, 2013 Try using file_get_contents() or use curl to get the raw data of the page. Quote Link to comment Share on other sites More sharing options...
djs1 Posted July 15, 2013 Author Share Posted July 15, 2013 Thanks for the reply. I'm able to use curl to get the data of a webpage, however, the GUI is only available through an IP Address. I'm having trouble with this. Here's the code I'm using: // Check for cURL if( !function_exists( 'curl_init' ) ) die( 'cURL is not installed.' ); // Create a cURL resource handler (cURL Handler = ch) $c = curl_init(); // Set options $c = curl_init('http://192.168.1.xx/u/r/l'); curl_exec($c); $output = curl_exec( $c ); curl_close( $c ); echo $output; Any ideas why this is returning a blank page? Thanks Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted July 15, 2013 Share Posted July 15, 2013 I guess I can just copy and past this all day: You need an editor with syntax highlighting and error reporting: error_reporting(-1); ini_set('display_errors', '1'); Parse error: syntax error, unexpected 'Handler' (T_STRING) in C:\tmp\new1.php on line 12 What the hell is this: (cURL Handler = ch) $c = curl_init(); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.