PHP fetches the value after fetching the page, as long as the middle value resolution method

Source: Internet
Author: User
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);
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.