PHP-Easy access to page content

Source: Internet
Author: User

no need to useCURLand thehttp_clientLibrary,PHPborn in Central Plainsfile ()and thefile_get_contents ()function can be implemented, as long as the file name parameter isURLcan be. The following is fromPHPdescription of the Help file (fromfopen ()function):

if filename is a"scheme://..."format, it is treated as aURL,PHPThe Search protocol processor (also known as the Encapsulation Protocol) is processed to handle this pattern. If the protocol has not yet registered the encapsulation protocol,PHPa message will be issued to help check for potential problems in the script and filename continue execution as an ordinary file name.

ifPHPThink filename specifies a local file that will attempt to open a stream on the file. The file must bePHPcan be accessed, so you need to verify that the file access permission allows that access. If you activate theSafe Modeor Open_basedirThe further restrictions apply.

ifPHPThink filename a registered protocol is specified and the protocol is registered as a networkURL,PHPwill check and confirm Allow_url_fopenhas been activated. If it's turned off,PHPa warning will be issued, andfopenthe call fails.

file ()with thefile_get_contents ()the difference isfile ()The function reads the contents into an array, which is appropriate for a binary file, andfile_get_contents ()reads the contents into a string and handlesHTTPthe request is more appropriate.

PHP-Easy access to page content

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.