array( 'proxy' => 'proxyserver:8080', 'request_fulluri' => True, 'method'=>'POST', 'header'=> "Content-type: application/x-www-form-urlencoded\r\n" ."Content-Length: " . strlen($data) . "\r\n", 'content' => $data ), ); $cxContext = stream_context_create($aContext); $content = file_get_contents($url, FILE_TEXT, $cxContext); return $content; /* $fp = @fopen($url, 'rb', false, $cxContext); if (!$fp) { throw new Exception("Problem with $url, $php_errormsg"); } $content = @stream_get_contents($fp); if ($content === false) { throw new Exception("Problem reading data from $url, $php_errormsg"); } */ } $url="http://biz.thestar.com.my/marketwatch/main.asp"; $data=array('bns'=>'2', 'clp'=>'1', 'klseViewDate'=>'1/30/2008' ); $content = http_post_content($url,$data); $htmlDoc = new DomDocument(); @$htmlDoc->loadHTML($content); $xPath = new DOMXPath($htmlDoc); $counters = $xPath->evaluate('//table[@id="Table2"]/tr/td[2]/center/table/tr/td/span[@class="text"]/table/tr/td/a'); for ($i = 0; $i < $counters->length; $i++){ print($counters->item($i)->nodeValue.'
'); } ?>