Heretiiik

Untitled

Nov 1st, 2015
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. <?php
  2.  
  3. $link = curl_init();
  4.  
  5. curl_setopt($link, CURLOPT_URL, "http://pid.idos.cz/odjezdy/?f=Malvazinky&t=Na+Kn%C3%AD%C5%BEec%C3%AD&tc=301003&fc=301003&submit=true");
  6. curl_setopt($link, CURLOPT_HEADER, 0);
  7. curl_setopt($link, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.16 Safari/537.36");
  8. curl_setopt($link, CURLOPT_RETURNTRANSFER, true);
  9.  
  10. $result = curl_exec($link);
  11.  
  12. echo '<pre>';
  13.  
  14. $result = substr($result,(strpos($result, "<table class=\"results\" border=\"0\">")));
  15. $result = substr($result, 0, -strlen($result)+strpos($result, "</table>")+8);
  16. //echo htmlspecialchars($result);
  17. $result = str_replace("&nbsp;", "", $result);
  18. //echo htmlspecialchars($result);
  19. $xml = simplexml_load_string($result);
  20. //var_dump($xml);
  21.  
  22. //echo $xml->tbody->tr[0]->td[0];
  23. foreach ($xml->tbody->tr as $item)
  24.   echo $item->td[0]."<br>";
  25. echo '</pre>';
Advertisement
Add Comment
Please, Sign In to add comment