PHP fetches the value after fetching the page, as long as the middle value
The page has the following values
Shenzhen ABC Electronics Co., Ltd.
Contact: Mr. Zhang
website: Http://www.ABCDE.com
Fax:
Tel:0755-888888888
e-mail:sales@ABCDE.com
Address: Shenzhen Futian District Road ABCDE Building R Block 9D
How to use the shortest regular to get company name, contact, fax, phone, mailbox, address and other variable information? Basically, they take out separately.
,
Equal to the middle value.
------Solution--------------------
PHP Code
$str =<<
Shenzhen ABC Electronics Co., Ltd.
-
-
Contact: Mr. Zhang
-
-
website:
Http://www.ABCDE.com
-
-
Fax:
-
-
Tel:0755-888888888
-
-
e-mail:sales@ABCDE.com
-
-
Address: Shenzhen Futian District Road ABCDE Building R Block 9D
Html;preg_match_all ('/<\/span> (. *?) <\/dd>|
-
-
(. *) <\/dt>/m ', $str, $arr);p Rint_r ($arr);
------Solution--------------------
PHP Code
Shenzhen ABC Electronics Co., Ltd.
-
-
Contact: Mr. Zhang
-
-
website:
Http://www.ABCDE.com
-
-
Fax:
-
-
Tel:0755-888888888
-
-
e-mail:sales@ABCDE.com
-
-
Address: Shenzhen Futian District Road ABCDE Building R Block 9D
Str;preg_match_all ('/
]*> (?:
(. *?):<\/span>)? (?:
]*>)? (.*?) (?:<\/span>) <\/d[dt]>/m ', $str, $matches);p rint_r ($matches [1]);p rint_r ($matches [2]);/*array ([0] = > [1] + = contacts [2] = = [3] + [4] [+] = [5] + [6] = + E-mail [+] = + address) Array ([0] = = Shenzhen ABC Electronics Co., Ltd. [1] = Mr. Zhang [2] = Http://www. abcde.com [3] = [4] = 0755-888888888 [5] = sales@ABCDE.com [6] = Shenzhen Futian District Upper step South Road ABCDE Building R Block 9D) */
------Solution--------------------
Uh...
Also need to improve the words according to: Cut the string to come out ...
PHP code
$str =<< Shenzhen ABC Electronics Co., Ltd.
-
span> Contact: Mr. Zhang
-
URL:
http:/ /www. abcde.com
-
Fax:
-
Tel: 0755-888888888
-
mailbox: sales@ABCDE.com
-
Address: Shenzhen Futian District South Road ABCDE Building R Block 9D
Html;echo strip_t
AGS ($STR);