>First of all, am I correct in assuming I could download a file and parse it
using fopen("url")?

Yup.  Pretty darn nifty, huh?

>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?

Yup, another fopen() and fgets() and away you go -- You snarfed the image.
You'll have to be kinda careful about your urls and files and not trip over
your own feet having two of each of them open at the same time, though. :-)
I'd say use $htmlurl and $imgurl, and $htmlfile and $imgfile to keep 'em
straight.

>    if(str_replace("IMG SRC", "", $newline) != $newline) {

This won't catch those heathens using lowercase or MixedCase for their HTML
tags.  While they deserve to burn in hell for it, I reckon you probably
would rather work with them while they're still here on Earth.

It also won't catch any heretics doing something wacky like <IMG BORDER=0
SRC=...>, which is, of course, totally immoral, even if it does match HTML
spec.

if (stristr($newline, "<IMG")){

will catch all legal image tags. :-)

Then you'll want something like:
ereg_match("*SRC\=(*) *", $newline, $parts);
$imgurl = $parts[2];
Only I always screw up regex, so you'll have to mess around with that part.

I think I'm getting punchy... Wonder why?...

Don't miss the Zend Web Store's Grand Opening on January 23, 2001!
http://www.zend.com
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to