I am trying to save in database PHP Simple HTML DOM Parser indentificators for specific fields and that I call each field indentificators and use them as follows:
$query='select description from ........';
$result = .....;
//-this is how description is saved in the database
// $html->find('div.shortd',0)->outertext();
$row[0]=$html->find('div.shortd',0)->outertext();
$description = $row[0]; - this should be equivalent of:
$description = $html->find('div.shortd',0)->outertext();
but it doesn't work
What format should I save $html->find('div.shortd',0)->outertext(); so after I call it from database to make it work..
Let me explain you briefly what it will be used for: Lets say I have 6000 suppliers. Each of them wish to upload products in my website. I made beta version of crawler which loads specific data from each supplier website so to successfully upload a product I just require the supplier to paste the url in his website of the product he wish to upload. Each website has different structure and now I am facing a problem with this because the structure of each website very vary. Lets say I wish to get img src of the product which may look like:
<div class="aa">
<p>text</p>
<p><img src="../url-to-image"></p>
</div>
so to get it I am doing this:
$image = $html->find('div.aa > p > img');
$image=$image->src;
This works if image is only 1 but to get all images I will have to loop trough images. So the only option for me is to save either:
$image = $html->find('div.aa > p > img');$image=$image->src;
in the database for single image website or similar code but including the loop code.. This is why I need to save it in database and than to load and make this php code working.. I hope now is more clear..
I tried with :
$description = eval($row[0]);
but it doesn't work also I can see in error log this:
syntax error, unexpected end of file in public_html/file.php: eval()'d code on line 1