Home > DeveloperSection > Forums > Techniques or tools for including a snippet of one web page in another
Manoj Bhatt
Manoj Bhatt

Total Post:153

Points:1079
Posted on    September-28-2013 4:27 AM

 CSS-CSS3 CSS-CSS3 
Ratings:


 1 Reply(s)
 958  View(s)
Rate this:


It's common practice to include snippets of one page in another as an image of the rendered content. This has obvious disadvantages, not least that text isn't being represented as text.

Are there any techniques or tools that allow swift excerpting from one web page, and embedding of the excerpted content in another page?

I imagine the excerpting process would have to capture enough stylesheet data to recreate it, as well as work out how to trim down the content to just the area being captured.

I imagine the embedding step may use the object element or something like that?

There must be a better way than capturing a rasterised rendering of the web page to be excerpted.



Ankita Pandey
Ankita Pandey

Total Post:183

Points:1285
Posted on    September-28-2013 6:57 AM

Hi Manoj!

Yes, its possible. after you cURL the page (for example) into a variable, you will need to replace any relative paths with absolute (to the webroot). You can achieve this with some regex.

  $domain = 'wwww.xyz.com';
   $result = 'Your html page data';
   $result = str_replace("src=\"","src=\"$domain\\",$result);

Don't want to miss updates? Please click the below button!

Follow MindStick