Jump to content

Recommended Posts

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

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

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();
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.