php get all div content from external website
<p>I want to get all div content of the site</p>

<p>I want to get this div</p>

<pre><code>&lt;div class="user_name"/&gt;
</code></pre>

<p>there are so many user_name as class name of the divs in the page but I want to get all div content</p>

<p>I have this code which I got it here <a href="https://stackoverflow.com/questions/20446598/get-div-content-from-external-website">Get DIV content from external Website</a></p>

<pre><code>$url = 'http://www.myexternalsite.com/user/1';
$content = file_get_contents($url);
$first_step = explode( '&lt;div class="user_name"/&gt;' , $content );
$second_step = explode("&lt;/div&gt;" , $first_step[1] );

echo $second_step[0];
</code></pre>