Downloading images through the use of code
| From: | Liam Gibbs | Date: | Mon, 22 Jan 2001 21:19:49 +0000 |
| Subject: | Downloading images through the use of code | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-36079@lists.php.net to get a copy of this message | ||
I have a question for a friend of mine (yes, it's actually for a friend of mine). Here is my
code below. First of all, am I correct in assuming I could download a file and parse it using
fopen("url")? Secondly, if I find an IMG tag, how would I go about grabbing the file that
is contained in the SRC of that image tag? Would another simple fopen() and fput() to another file
work with that, or is there an easier way?
$file = fopen("http://url");
while(!feof($file)) {
$newline = fgets($file);
if(str_replace("IMG SRC", "", $newline) != $newline) {
/*do stuff*/
}
}
Thanks a lot everyone!
Liam...