TECHNIQUES OR TOOLS FOR INCLUDING A SNIPPET OF ONE WEB PAGE IN ANOTHER

Manoj Bhatt

Total Post:154

Points:1086
Posted by  Manoj Bhatt
 1279  View(s)
Ratings:
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.

  1. Ankita Pandey

    Post:183

    Points:1285
    Re: Techniques or tools for including a snippet of one web page in another

    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);

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!