$page = 'http://minfin.com.ua/currency/usd/'; header('Content-Type: text/html; charset=utf-8'); $cl2 = curl_init(); curl_setopt($cl2, CURLOPT_URL, $page); curl_setopt($cl2, CURLOPT_RETURNTRANSFER, 1); curl_setopt($cl2, CURLOPT_HEADER, 0); curl_setopt($cl2, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6'); curl_setopt($cl2, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($cl2, CURLOPT_TIMEOUT, 60); curl_setopt($cl2, CURLOPT_REFERER, $page); $page = curl_exec($cl2); curl_close($cl2); $doc = new DOMDocument(); libxml_use_internal_errors(true); $doc->loadHTML($page); $xpath = new DOMXPath($doc); $table = $xpath->query('//table[@class="tstyle b-mrg"]')->item(0); foreach($table->getElementsByTagName('tr') as $tr) { $tds = $xpath->query('.//td', $tr); if ($tds->length == 4) { $name = $tds->item(1)->textContent; $rate = $tds->item(2)->textContent; echo $name. ": " . $rate . "<br>"; } } |