I scraped html data from web sites using simplehtmldom_1_5 and after scraped I want to insert every text in a <p>
tag with different id of every <p>
tag as a explained below:
Suppose scrapped data:
<div class="maincontainer">
<div class="first">
first text
</div>
<div class="second">
second text
</div>
<div class="third">
third text
</div>
<div class="fourth">
fourth text
</div>
fifth string
</div>
And I want result like this below:
<div class="maincontainer">
<div class="first">
<p id="1">first text </p>
</div>
<div class="second">
<p id="2">second text </p>
</div>
<div class="third">
<p id="3">third text </p>
</div>
<div class="fourth">
<p id="4">fourth text </p>
</div>
<p id="5"> fifth string </p>
</div>
Guys I want to do this during scraping not after scraping.