How to get HTTPS website data in PHP string?

Is there a function by which you specify the website URL and returns the source in a string?

+3
source share
1 answer

Yes,

  • file_get_contents- Reads the entire file into a string. The URL can be used as the file name with this function if fopen wrappers were included.

Example:

file_get_contents('https://www.example.com');

Otherwise, cURL and HTTP will do.

If you want to analyze the content on the page most likely, you will want to use the DOM Parser .

+2
source

Source: https://habr.com/ru/post/1771686/


All Articles