Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. <?php
  2. $_SERVER['DOCUMENT_ROOT'] = $_SERVER['DOCUMENT_ROOT'] ?: dirname( dirname(
  3. (dirname(__FILE__))));
  4. $_SERVER['REMOTE_ADDR'] = "127.0.0.1";
  5. $filename = file($_SERVER['DOCUMENT_ROOT'].'/sitemap.txt');
  6. $idF = 0;
  7. foreach($filename as $key=>$value)
  8. {
  9. if($key != 0)
  10. {
  11. $page_content = file_get_contents($value);
  12. preg_match_all('|<span class="js-code">(.*)</span>|sUSi', $page_content, $titles[$idF]['id']);
  13. preg_match_all('|<h1 class="title">(.*)</h1>|sUSi', $page_content, $titles[$idF]['name']);
  14. preg_match_all('|<p class="decor_6">(.*)</p>|sUSi', $page_content, $titles[$idF]['description']);
  15. $titles[$idF]['link'] = $value;
  16. preg_match_all('|<span class="apiimg">(.*)</span>|sUSi', $page_content, $titles[$idF]['image_link']);
  17. $titles[$idF]['availability'] = 'in stock';
  18. preg_match_all('|<span class="price priceOrigVariant oldpr">(.*)</span>|sUSi', $page_content, $titles[$idF]['price']);
  19. preg_match_all('|<span class="price priceVariant newsales">(.*)</span>|sUSi', $page_content, $titles[$idF]['sale_price']);
  20. preg_match_all('|<span id="bran65">(.*)</span>|sUSi', $page_content, $titles[$idF]['brand']);
  21. $titles[$idF]['identifier_exists'] = 'no';
  22. $titles[$idF]['condition'] = 'new';
  23. $idF++;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement