"; if($i == 65) { curl_setopt($ch, CURLOPT_URL, 'http://ekeystone.com/WebPage.aspx?pn=1100000BrowseByDescr'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "name=_ctl0:_ctl6:_ctl0"); $content = curl_exec ($ch); } else { curl_setopt($ch, CURLOPT_URL, 'http://ekeystone.com/WebPage.aspx?pn=1100000BrowseByDescr'); curl_setopt($ch, CURLOPT_POST, 1); $POSTAL = array('__VIEWSTATE' => $curstate, '__EVENTTARGET' => "lblbbd".$i, '__EVENTARGUMENT' => '', 'SearchOptions' => 'rb1Search', 'txtSearchKey' => ''); curl_setopt($ch, CURLOPT_POSTFIELDS, $POSTAL); $content = curl_exec ($ch); } //echo $content; $html = $content; $parser = new HtmlParser ($html); while ($parser->parse()) { echo "INSIDE WHILE"; $attributes = $parser->iNodeAttributes; if($data_now) { //Open or closed -- open if($parser->iNodeType != "2") { // if($data_next) { if($parser->iNodeName == "input" && preg_match("/browse/i", $attributes['title'])) { $num = str_replace("(","",$attributes['title']); $num = str_replace(")","",$num); $num = explode(" ", $num); $categories[][1] = $num[count($num)-1]; echo "NEW CAT:".$num[count($num)-1]; $inputbefore = true; } if($parser->iNodeType == "3" && $inputbefore ) { $categories[(count($categories) - 1)][0] = preg_replace("/ /", "", $parser->iNodeValue); $data_next = false; $inputbefore = false; echo "should quit"; } } //Row number if($parser->iNodeName == "tr") $cur_row++; //Column if($parser->iNodeName == "td") { $data_next = true; } } else { //Closed } echo "END OF ELSE"; error_reporting(E_ALL); } else { echo "START OF ELSE CONDITION"; if($parser->iNodeName == "input") { if($attributes['name'] == "__VIEWSTATE") $curstate = $attributes['value']; } if($parser->iNodeName == "table") { if($attributes['id'] == "BrowseDG") $data_now = true; } } echo "AFTER END OF ELSE"; } echo "while is done"; //echo "
"; }