0

I need to embed a search form from external website. Currently I am using the IFRAME with css trick

#outerdiv{ width:446px; height:246px; overflow:hidden; position:relative; }
#inneriframe{ position:absolute; top:-412px; left:-318px; width:1280px; height:1200px; }
<div id="outerdiv"><div id="innerdiv"><iframe></iframe></div></div>

which helps to display particular div only but i want to load particular div rather than whole site and display particular div.

I tried PHP SIMPLE DOM PATSER (Fetching Data From A Specific div id Using PHP)

include('simple_html_dom.php');
$html = file_get_html("http://www.farebuzz.com");
$displaybody = $html->find('div[class=search_bg]', 0)->plaintext;    

But it only gives the content without stylesheet and functionality.

So is there any way of fetching particular div along with it's style and functionality.

Community
  • 1
  • 1
Ramesh
  • 1,384
  • 2
  • 12
  • 19

1 Answers1

0

You seem to be on the right path. If the site from which you are trying to fetch the div from has not provided a way to embed the div, then the only alternative, as far as i can see, is to fetch the div you are interested in using some sort of script just like you did.

However to get the "style and functionality" as well, what i would do is find out which stylesheets and/or javascripts are being used in the div and just include them. If you go this way, maybe it would be best to create a separate file for the fetched content, and then call it to your site in an iFrame. That way the scripts and styles only affect the contents in the iFrame.

If you maintain the attributes/properties (of the elements you will be fetching), I see no reason why the css and/or javascript would not work.

user1678293
  • 85
  • 1
  • 10