Home>Article>Backend Development> How to get the source code of a web page using php?

How to get the source code of a web page using php?

王林
王林 Original
2019-09-07 10:01:10 9675browse

How to get the source code of a web page using php?

Article text content:

How to get the source code of a web page using php?

The following are several commonly used ways to obtain web page source code:

1. file_get_contents

How to get the source code of a web page using php?2.curl

##3.fopen- >fread->fcloseHow to get the source code of a web page using php?

How to get the source code of a web page using php?

##Note

:1. Use file_get_contents and fopen must enable allow_url_fopen.

Method: Edit php.ini and set allow_url_fopen = On. When allow_url_fopen is turned off, neither fopen nor file_get_contents can open remote files.

2. To use curl, you must have space to enable curl.

Method: Modify php.ini under Windows, remove the semicolon in front of extension=php_curl.dll, and copy ssleay32.dll and libeay32.dll to C:WINDOWSsystem32; install the curl extension next.

If you want to know more related content, please visit the php Chinese website:

PHP video tutorial

The above is the detailed content of How to get the source code of a web page using php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:what is destructor in php Next article:what is destructor in php