Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <?php
  2. $con = mysql_connect("mysql.tndls.tk","ravonus","");
  3. // Check connection
  4. if(! $con )
  5. {
  6. echo "Failed to connect to MySQL: " . mysql_error();
  7. }
  8.  
  9.  
  10. $urls = array();
  11.  
  12. $DomDocument = new DOMDocument();
  13. $DomDocument->preserveWhiteSpace = false;
  14. $DomDocument->load('http://xivdb.com/sitemap/?item/sitemap.xml');
  15. $DomNodeList = $DomDocument->getElementsByTagName('loc');
  16.  
  17. foreach($DomNodeList as $url) {
  18. $urls[] = $url->nodeValue;
  19. }
  20. foreach($urls as $url) {
  21. $url = str_replace('http://xivdb.com/?item/', '', $url);
  22. $item = split('/', $url);
  23. $item1 = mysql_real_escape_string($item['1']);
  24. $item2 = mysql_real_escape_string($item['0']);
  25. //var_dump($item);
  26.  
  27. //store $item[0] and $item[1] to db in the proper cols
  28.  
  29. //echo ($item['1']);
  30. //echo ($item['0']);
  31.  
  32.  
  33. //$name = ($item['1']);
  34. //$id = ($item['0']);
  35. mysql_query($sql, $con);
  36. mysql_select_db( 'ff14' );
  37. $name = mysql_real_escape_string($name);
  38. $sql="INSERT INTO `tooltips` (Name, ID)
  39. VALUES ('$item1', '$item2')";
  40. echo ($item['0']);
  41. echo ($item['1']);
  42.  
  43. }
  44. mysql_close($con);
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement