All Posts by Email, Once a Week

Media Temple logo

CSS-Tricks is brought to you in part by Media Temple, the web hosting that we both use and recommend.

extract div container of any website in our site

  • # March 18, 2013 at 4:23 am

    if anyone know how to extract same data container of any div in our own website…from php??
    I have dont this

    < ?php include(‘simple_html_dom.php’);
    $content = file_get_contents_curl(“”);

    $html = str_get_html($file_contents);
    $elem = $html->find(‘div[id=main]’, 0);

    and nothing happened. :(

    # March 18, 2013 at 5:16 am

    ok i got the solution

    < ?php  include_once(‘simple_html_dom.php’);
    $html = file_get_html(“”);
    $displaybody = $html->find(‘div[id=brandmenu]’, 0);
    echo $displaybody;


    but my question is how to dynamically change the links….i want the php code where our links to the site changes according to changes its link…

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed