Last active
November 17, 2017 00:46
-
-
Save spacebit-official/9f40673e3929884bbaba7e841e11bd3e to your computer and use it in GitHub Desktop.
regParse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//парсинг с помощью регулярных выражений | |
$url = 'http:///'; | |
$file = file_get_contents($url); | |
$pattern = '#<table class="rates-table-nbrb".+?</table>#s'; | |
preg_match($pattern, $file, $matches); | |
print_r($matches); | |
#<body.+>(.*?)</body>#su //с учетом атрибутов | |
#<div[^>]+?id\s*?=\s*?["\']content["\'][^>]*?>(.+?)</div>#su | |
#<div[^>]+?id\s*?=\s*?(["\'])content\1[^>]*?>(.+?)</div>#su //первая ковычка ложится в карман |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment