Code: Select all
var_dump($sections[7][5]);Code: Select all
<?php
ob_start();
$url = 'http://m.cricbuzz.com/cricket-archive/scorecard/10777/1';
$dom = new DOMDocument;
@$dom->loadHTMLFile($url);
$tds = $dom->getElementsByTagName('td');
foreach ($tds as $td)
{
echo $td->nodeValue, PHP_EOL;
}
$page = ob_get_contents();
ob_end_flush();
$fp = fopen("output.html","w");
fwrite($fp,$page);
fclose($fp);
$pieces = explode("Bowler", file_get_contents('output.html', FILE_IGNORE_NEW_LINES));
$zaq = explode("\n", $pieces[0]);
unset($zaq[0],$zaq[1],$zaq[2],$zaq[3],$zaq[4]);
for($i=0;$i<count($zaq);$i++)
{
if ($zaq[$i]=='') { unset($zaq[$i]); echo 'reached here.. '; }
}
foreach($zaq as $value)
{
echo '<br>the next elemnt is.. '.$value.'<br>';
}
$sections = array_chunk($zaq, 6);
var_dump($sections[7][5]);
echo array_search('not out', $sections);
print_r(array_values($sections));
print_r(array_keys($sections));
echo array_key_exists('not out', $search_array);
for($i=0;$i<count($zaq);$i++)
{
echo $sections[$i][5].'<br>..';
echo count($sections[$i][5]);
$as=count($sections[$i][5]);
if($sections[$i][5]==="'not out")
{
echo count($sections[$i][5]);
echo $sections[$i][5];
var_dump($sections[$i][5]);
}
}
?>