finding links to jpg,mpg,avi
| From: | Mag | Date: | Fri, 08 Oct 2004 19:20:42 +0000 |
| Subject: | finding links to jpg,mpg,avi | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-199021@lists.php.net to get a copy of this message | ||
Hi,
I have seen this functionality in a PERL
program/script and would like to do the same
thing...but in php.
The way the script worked was, you give it a url:
http://somesite.com/pics-and-movies.html
pics-and-movies.html (the above example page) would
contain something like:
<html>
<body>
<a href=pic1.jpg> pic 1</a>
<a href=pic2.jpg> pic 2</a><br>
...
<a href=mgp1.mpg> mpg 1</a>
<a href=mpg2.mpg> mpg 2</a><br>
</body>
</html>
the scipt would find ONLY the links pointing to either
a .jpg or a .mpg and then display the size of each.
This is how far I have come:
1: via fopen download the entire page (done)
2: scan the page for all where href ends with .jpg or
mpg (cant work out logic for this)
3: send the names and url to a function to get the
sizes of each (did this with help from the php manual!
yeahhh!!)
biggest problem I have come accross is that the link
can be written like this
<a href='pic.jpg'> or
<a href="pic.jpg"> or
<a href=pic.jpg> or
<a class='blah' href='pic.jpg'>
etc
HOW are these guys doing it? anybody? (I think I need
regex here...but dont know regex :-(( )
Thanks,
Mag
=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail