finding links to jpg,mpg,avi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux