I need to extract a data on my site from another site but data can be extract but this error show which are mention in below.
Notice: Undefined offset: 1 in D:\xampp\htdocs\simplehtmldom\index.php on line 26
Please help me to solve out this problem. I am really greatful for your valuable answer.
My code is
<?php
include('simplehtmldom/simple_html_dom.php');
$html = new simple_html_dom();
$html->load_file("http://www.nepalstock.com/companydetail.php");
if (!empty($html)){
$table = $html->find('table[width="100%"]');
}
if(!empty($table)){
$i = 0;
$data = array();
foreach ($table[0]->find('tr') as $tr) {
$i++;
if ($i == 1 || $i == 2) continue;
$td = $tr->find('td');
array_push($data, array(
'paid_up_value' => trim($td[0]->plaintext),
'total_paid_up_value' => trim($td[1]->plaintext), //This is my line 26
'closing_market_price' => trim($td[2]->plaintext),
'market_capitalization' => trim($td[3]->plaintext),
'market_capitalization_date' => trim($td[4]->plaintext),
'previous_closed'=>trim($td[5]->plaintext)
)
);
}
}
$html->clear();
unset($html);
if (empty($data)) exit('No data !!!');
print '<pre>';
print_r($data);
print '</pre>';
?>