Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.59 KB | None | 0 0
  1. <?php
  2. include_once('./../parser/simple_html_dom.php');
  3. //include_once('./../functions.php');
  4. //include_once('./../connection.php');
  5.  
  6. //$json = '{"data":[{"url":"https:\/\/d-gr.ppstatic.pl\/kadry\/k\/r\/gr-ogl\/24\/80\/2613984_202115698_mieszkanie-warszawa-bialoleka-ul-swiatowida_xlarge.jpg","thumb":"https:\/\/d-gr.ppstatic.pl\/kadry\/k\/r\/gr-ogl\/24\/80\/2613984_202115698_mieszkanie-warszawa-bialoleka-ul-swiatowida_small.jpg"}]}';
  7. //$decoded = json_decode($json);
  8. //$data = $decoded->data;
  9. //foreach ($data as $row){
  10. //    var_dump($row->url);
  11. //}
  12.  
  13. //return;
  14. $details = file_get_html("https://gratka.pl/nieruchomosci/mieszkanie-warszawa-bialoleka-ul-swiatowida/oi/2613984");
  15.  
  16. $scripts = $details->find("script");
  17.  
  18. //echo "<hr>Count:".count($scripts)."<hr>";
  19.  
  20. $photos = $scripts[32]->innertext;
  21.  
  22.  
  23. echo "<hr>".$photos."<hr>";
  24. //echo $photos."<hr>";
  25. preg_match('/(data")\s*:([^\]]+)/', $photos, $photos);
  26. if(isset($photos[2])){
  27.     var_dump($photos[2]);
  28.     echo "<hr>";
  29.     preg_match('/"url":.+?(?=,)/', $photos[2], $p);
  30.     echo "wynikow: ".count($p)."<hr>";
  31.     foreach ($p as $px) {
  32.         echo $px . "<br>";
  33.     }
  34. }
  35. //            if(isset($photos[1])) $this->latitude = $latitude[1];
  36.  
  37.  
  38. //foreach($scripts as $key => $s){
  39. //        echo "<hr>nr $key<hr>".$s->innertext;
  40. //}
  41.  
  42. /*
  43. $description = $details->find("div[class=description__rolled ql-container]")[0]->plaintext;
  44. print_r($description);
  45.  
  46. $details = $details->find("meta[property=og:image]");
  47.  
  48. echo "<hr>".count($details);
  49.  
  50. foreach ($details as $det){
  51.     echo "<img src='".$det->getAttribute('content')."'>";
  52. }
  53. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement