Bifalgorithm post · Computer science one · Closing Files
How can PHP use URLs as file names?
How can PHP use URLs as file names? (Computer science one · Closing Files) — "44.2.1. Using URLs A nice feature of PHP is that you can use URLs as file names t…
Ideas in this flowchart
- Using URLs as file names in PHP
- PHP can use URLs as file names for reading and writing
- Reading from a URL connects to a remote resource and downloads its contents
- Downloaded contents may be HTML, XML, or JSON data
- Writing to a URL can post data to a web page and receive a response
- Example: downloading a webpage from http://cse.unl.edu
- Open the webpage URL for reading with fopen
- Initialize an empty string to store the downloaded contents
- Read and append lines until the end of the file is reached
- Alternatively, download the complete webpage with file_get_contents