29. 07. 2011. | #121 | |
profesionalac
Professional
Datum učlanjenja: 30.08.2010
Poruke: 201
Hvala: 10
640 "Hvala" u 14 poruka
|
Citat:
Meni treba samo da neko objasni par mogucih varijanti ovoga: Kôd:
$xpath->query("//h2[@class='title']")->item(0)->textContent; |
|
29. 07. 2011. | #122 |
expert
Grand Master
Datum učlanjenja: 11.04.2010
Poruke: 998
Hvala: 141
959 "Hvala" u 153 poruka
|
|
29. 07. 2011. | #123 |
profesionalac
Professional
Datum učlanjenja: 30.08.2010
Poruke: 201
Hvala: 10
640 "Hvala" u 14 poruka
|
prostudiracu, hvala !
|
29. 07. 2011. | #124 |
profesionalac
Professional
Datum učlanjenja: 30.08.2010
Poruke: 201
Hvala: 10
640 "Hvala" u 14 poruka
|
Nece pa nece Da li je neko raspolozen da izparsiramo ovaj link i uz put da diskutujemo:
Kôd:
http://www.viamichelin.com/web/Meteo?strLocid=31NDIxZzMxMGNORE11T0RVNU1UWT1jTVRndU5ETXpPRGs9 Kôd:
function curl($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_ENCODING, "gzip"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); return $data; } $html = curl('http://www.viamichelin.com/web/Meteo?strLocid=31NDNhZGwxMGNOREl1T0RjeE5qVT1jTVRndU5ERTNNamc9'); preg_match_all('#<div class="sMainForecast"(.*?)</div></div>#is', $html, $matches); $matches = implode("", $matches[0]); echo $matches; |
29. 07. 2011. | #125 |
expert
Grand Master
Datum učlanjenja: 11.04.2010
Poruke: 998
Hvala: 141
959 "Hvala" u 153 poruka
|
Ja mislim da kod ViaMichelin JS generiše HTML, idi na Disable JS, i otvori Source da vidiš kakva je situacija i gdje se to nalazi, vjerovatno su escapeovani specijalni karakteri.
http://webarto.com/53/viamichelin-php-class |
30. 09. 2011. | #126 |
expert
Expert
Datum učlanjenja: 15.03.2011
Poruke: 518
Hvala: 16
20 "Hvala" u 17 poruka
|
Kako to da ovaj kod na jednom serveru radi kupondo.adriamart.com/grupovina1.php a na drugom pluspon.com/grupovina1.php NE
<?php function curl($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_ENCODING, "gzip"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); return $data; } $dom = new DOMDocument(); @$dom->loadHTMLFile('http://www.grupovina.rs/beograd/'); $xpath = new DOMXPath($dom); $entries = $xpath->query("//div[@class='deal-medallion-heading']//h1//a/@href"); $output = array(); foreach($entries as $e) { $dom2 = new DOMDocument(); @$dom2->loadHTMLFile($e->textContent); $xpath2 = new DOMXPath($dom2); $data = array(); $data['link']= ($e->textContent); $data['naslov'] = trim($xpath2->query("//div[@class='inner-deal-heading']//h2")->item(0)->textContent); $data['slika'] = trim($xpath2->query("//li/img/@src")->item(0)->textContent); $location = $xpath2->query("//div[@class='inner-deal-column-block']//script")->item(1)->textContent; preg_match('/var\s+latitude\s+=\s+(\d+\.\d+)\s*;/', $location, $lat); preg_match('/var\s+longitude\s+=\s+(\d+\.\d+)\s*;/', $location, $lng); $data['lat'] = $lat[1]; $data['lng'] = $lng[1]; $image_url = $data['slika']; $ch = curl_init(); $timeout = 0; curl_setopt ($ch, CURLOPT_URL, $image_url); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $image = curl_exec($ch); curl_close($ch); $novalat = str_replace ('.','',$data['lat']); $lele = 'slike/'.$novalat.'.jpg'; $lele = str_replace(' ', '-', $lele); $i = $i+1; $f = fopen($dyhgu, 'w'); fwrite($f, $image); fclose($f); $naslov = $data['naslov']; $latitude = $data['lat']; ...... i tako dalje; $latitude = (float) $latitude; $longitude = (float) $longitude; mysql_connect ("localhost", "dddddddddddd", "aaaaaaaa") or die ('Error: '.mysql_error()); mysql_select_db ("ddddddddddd"); $naslov = mysql_real_escape_string($naslov); $query="INSERT INTO markers (location_ID, name, lat, lng, ITD!... ) VALUES (NULL,'$... ... ... $... ... .. ...')"; mysql_error(); mysql_query($query) or die ('Error updating database'); echo "Baza je updejtovana sa: " .$... ... ... ....." "; $output[] = $data; } ?> Postoje jos nekoliko takvih fajlova koji se neizvrsavaju iako nema greske u kodu, sta bi mogao da bude razlog za to? Poslednja izmena od AdriaMart : 30. 09. 2011. u 18:46. |
30. 09. 2011. | #127 |
expert
Grand Master
Datum učlanjenja: 11.04.2010
Poruke: 998
Hvala: 141
959 "Hvala" u 153 poruka
|
Nemaš cURL (možda je upaljen safe_mode) ili neki drugi modul..
PHP kôd:
|
30. 09. 2011. | #128 |
expert
Expert
Datum učlanjenja: 15.03.2011
Poruke: 518
Hvala: 16
20 "Hvala" u 17 poruka
|
da, ali drugi fajlovi koji izvlace ponude sa drugih sajtova rade bez problema jedino ovaj pravi probleme???
|
30. 09. 2011. | #129 |
banned
Professional
Datum učlanjenja: 04.06.2005
Poruke: 371
Hvala: 0
738 "Hvala" u 83 poruka
|
Proveri ove XPath izraze za izvlačenje podataka sa pojedinačnih stranica.
__________________
Don't look at me; I'm lost too. “If you can't dazzle them with brilliance, baffle them with bul*s**t.” |
30. 09. 2011. | #130 |
expert
Expert
Datum učlanjenja: 15.03.2011
Poruke: 518
Hvala: 16
20 "Hvala" u 17 poruka
|
|
|
|