Skip to content

Instantly share code, notes, and snippets.

@synackme
Last active August 31, 2020 11:22
Show Gist options
  • Save synackme/8375590 to your computer and use it in GitHub Desktop.
Save synackme/8375590 to your computer and use it in GitHub Desktop.
Downloading a file from the Web with fopen() and fgets()
<?php
# Define the file you want to download
$target = "http://www.WebbotsSpidersScreenScrapers.com/hello_world.html";
$file_handle = fopen($target, "r");
# Fetch the file
while (!feof($file_handle))
echo fgets($file_handle, 4096);
fclose($file_handle);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment