Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Return parsed price value from $link page
- * @param string $link
- * @return float
- */
- function getPrice( $link )
- {
- $page = file_get_contents($link);
- if ( empty($page) )
- {
- return 0;
- }
- if ( preg_match_all('#<meta itemprop="price" content="(\d+)">#iu', $page, $matches))
- {
- return floatval(array_shift($matches[1]));
- }
- return 0;
- }
- var_dump(getPrice('http://www.vseinstrumenti.ru/santehnika/svar-pay-app-plast-poliprop-trub/inforce/03-12-02/'));
- // Напечатает double(2859)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement