note 57191 deleted from ref.filesystem by nlopess
| From: | nlopess@php.net | Date: | Tue, 27 Sep 2005 18:17:19 +0000 |
| Subject: | note 57191 deleted from ref.filesystem by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-95890@lists.php.net to get a copy of this message | ||
Note Submitter: vladson at pc-labs dot info
----
If the fopen wrappers have been disabled (allow_url_fopen) you can use a URL as a filename with this
function...
<?php
/**
* url_get_contents by http://vladson.pc-labs.info/
*
* string url_get_contents ( string url )
**/
function url_get_contents($url) {
$url_info = parse_url($url);
$query = "GET " . $url_info['path'] . " HTTP/1.0\r\n";
$query .= "Host: " . $url_info['host'] . "\r\n";
$query .= "Accept: */*\r\n";
$query .= "\r\n";
$fp = fsockopen($url_info['host'], 80);
fputs($fp, $query);
while( !feof($fp) ) {
$content .= fread($fp, 2048);
}
fclose($fp);
return substr($content, strpos($content, "\r\n\r\n")+4);
}
?>