fragment strony:
Kod php:
<?php $pol=mysql_connect('localhost', 'root', '') or die('BÄąâ₏šĂ„â₏Œd poÄąâ₏šĂ„â₏Œczenia: '.mysql_error()); $adres="http://www.domena.pl/"; $url = curl_init($adres); curl_setopt($url, CURLOPT_USERAGENT, 'holmes/3.10.1 (OnetSzukaj/5.0; +http://szukaj.onet.pl)'); curl_setopt($url, CURLOPT_RETURNTRANSFER, 1); curl_setopt($url, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($url, CURLOPT_HEADER, 0); $strona=curl_exec($url); $DOM = new DOMDocument(); @$DOM->LoadHTML(iconv("UTF-8","UTF-8",$strona)); foreach($DOM->getElementsByTagName('tr') as $tr) { $class = $tr->getAttribute('class'); if($class == 'odd' OR $class == 'add') { foreach($td->getElementsByTagName('a') as $a) { $href = $a->getAttribute('href'); //$sql="INSERT INTO krs (`adres`) VALUE ('$href')"; //$dane = mysql_query($sql); //echo mysql_errno() . ": " . mysql_error(); } } } ?>