Concept

How can PHP use URLs as file names?

ComputerScienceOne / Closing Files

"44.2.1. Using URLs A nice feature of PHP is that you can use URLs as file names to read and write to a URL. “Reading” from a URL mean connecting to a remote resource, such as a webservice and downloading its contents (which may be HTML, XML or JSON data). Writing to a URL may be used to post data to a web page in order to receive a response. As an example, we can download a webpage in PHP as follows.\n\n1 $h = fopen(\"http://cse.unl.edu\", \"r\");\n\n2 $contents = \"\";\n\n3 while(!feof($h)) {\n\n4 $contents .= fgets($h);\n\n5 }\n\n6\n\n7 //or just:\n\n8 $contents = file_get_contents(\"http://cse.unl.edu\");"

Related Ideas

How can PHP use URLs as file names? | ComputerScienceOne | Bifalgorithm | Bifalgorithm