Use cURL to capture a page with a data table and obtain all the cells under TR. use the following method to {code ...} however, the {code...} cannot be matched in two cases ...} and {code ...} I don't know why the cells with many spaces cannot match the cells with class? Because no... capture a page with data tables through cURL, as long as you get all the cells under TR, use the following method
$ Content = content; preg_match_all ('/(.*?) <\/Td>/', $ content, $ res );
However, two cases cannot match
Content
And
Unpaid
I don't know why the cells with many spaces cannot match the cells with class? Because there is no regular expression, a pattern can completely match the TD.
Another problem is that there are two tables on the page. one is used to filter data by various conditions and the other is used to store data. how can we match only the table that stores the data?
Reply content:
Capture a page with a data table through cURL. to obtain all the cells under TR, use the following method:
$ Content = content; preg_match_all ('/(.*?) <\/Td>/', $ content, $ res );
However, two cases cannot match
Content
And
Unpaid
I don't know why the cells with many spaces cannot match the cells with class? Because there is no regular expression, a pattern can completely match the TD.
Another problem is that there are two tables on the page. one is used to filter data by various conditions and the other is used to store data. how can we match only the table that stores the data?
. Line breaks cannot be matched in single row mode.
You can use
\ S matches any blank space character \ S matches any character that is not a blank space character
Match the td with the class.
/
([\s\S]+?)<\/td>/
Matching one of the tables is similar. first, match the table from all the contents to an array.
/
([\s\S]+?)<\/table>/
Then, let's see the number of times you want to use the regular expression above.
Let's say the opposite!
$pattern = "/
([\s\S]*?)<\/td>/";
I don't know either. maybe I can.