Thursday, December 09, 2004

How to open a file as a string from a URL in PHP?

//
// This will read the text file from http://yoursite.com/test.txt

// and store the contents of test.txt into $contents

//


$handle = fopen("http://yoursite.com/test.txt", "rb");

$contents = '';

while (!feof($handle)) {

$contents .= fread($handle, 8192);

}

fclose($handle);

1 comment:

Anonymous said...

wyoming home equity loans