I would like to ask you how to obtain the total score of level 4 and Level 6 after revision by using regular expressions (I will obtain the total score of the old version)
This is a 46-level website.
Name: |
Zhao Yang |
Schools: |
Changchun University of Traditional Chinese Medicine |
Exam type: |
English 4 |
Admission Ticket No: |
220090132112529 |
Exam time: |
December 2013 |
Total score: |
0 Hearing: 000 Read: 000 Writing and translation: 000 |
This is my code
$ A = curl_exec ($ ch); $ match = "#(.*)# "; // $ Match = "#(. *) # "; preg_match_all ($ match, $ a, $ B); $ yourname = $ B [1] [0]; $ school = $ B [1] [1]; $ cet = $ B [1] [2]; $ c = $ B [1] [5]; // score $ score = strip_tags ($ c); $ score = str_replace ("", "", $ score); return array ('school '=> $ school, 'name' => $ yourname, 'cet '=> $ cet, 'Score' => $ score );
All others can be obtained, and the total score cannot be obtained.
Reply to discussion (solution)
$ A = <TXT
Name: |
Zhao Yang |
Schools: |
Changchun University of Traditional Chinese Medicine |
Exam type: |
English 4 |
Admission Ticket No: |
220090132112529 |
Exam time: |
December 2013 |
Total score: |
0 Hearing: 000 Read: 000 Writing and translation: 000 |
TXT; $ match = "#
(.*?)# Is "; preg_match_all ($ match, $ a, $ B); $ B [1] [11] = preg_replace ('/\ s /','', strip_tags ($ B [1] [11]); print_r ($ B [1]);
Array
(
[0] => name:
[1] => Zhao Yang
[2] => School:
[3] => Changchun University of Traditional Chinese Medicine
[4] => test type:
[5] => CET-4
[6] => admission ticket No:
[7] = & gt; 220090132112529
[8] => test time:
[9] => December 2013
[10] => Total score:
[11] => 0 listening: 000 reading: 000 writing and translation: 000
)
$ A = <TXT
Name: |
Zhao Yang |
Schools: |
Changchun University of Traditional Chinese Medicine |
Exam type: |
English 4 |
Admission Ticket No: |
220090132112529 |
Exam time: |
December 2013 |
Total score: |
0 Hearing: 000 Read: 000 Writing and translation: 000 |
TXT; $ match = "#
(.*?)# Is "; preg_match_all ($ match, $ a, $ B); $ B [1] [11] = preg_replace ('/\ s /','', strip_tags ($ B [1] [11]); print_r ($ B [1]);
Array
(
[0] => name:
[1] => Zhao Yang
[2] => School:
[3] => Changchun University of Traditional Chinese Medicine
[4] => test type:
[5] => CET-4
[6] => admission ticket No:
[7] = & gt; 220090132112529
[8] => test time:
[9] => December 2013
[10] => Total score:
[11] => 0 listening: 000 reading: 000 writing and translation: 000
)
But the content in $ a should be changed.
The content is changed and the format is fixed.
Otherwise, it doesn't matter "Collection ".
The content is changed and the format is fixed.
Otherwise, it doesn't matter "Collection ".
Is there a question about the last line?> Error
I took this
$ Match = "# (.*?)# Is ";
Escape or error