Hi John,
Thank you for replying.
>> once a person submits a site, they are doing 2
things
>> that totally puzzle me,
>> 1.showing the number of "outgoing links"
> Middle man. You have them click on a link containing
> an ID, increment
> the counter for that ID, then forward them to the
> requested link.
I'm not sure I understand what you mean here.
This is how far I have come trying to imitate the
above: (Its not working of course :-) )
<?php
$url=fsockopen('http://www.jumac.com/');
$html = implode('', file("$url")); //put the page
source in a string
//find the links and put them in an array
$links = array();
if (preg_match_all('/<a\s+.*?href=[\"\']?([^\"\'
>]*)[\"\']?[^>]*>.*?<\/a>/i', $html, $matches))
{
foreach($mathes as $match){$links[] = $match;}
}
//check for offsite links
$parsed_url = parse_url($url); //parse the url
$thissite = $parsed_url['host'];
$ii=0;
foreach($links as $link){
if (strstr($link, 'http://') AND !strstr($link,
"$thissite")){ //the link is not relative, and not
on this host
$ii++;
}
}
print "There were $ii offsite links";
?>
>> 2. counting the number of linked to pictures (eg:
>> href='blah.jpg') and movies (eg: href='blah,mpg')
and
>> also giving the size of each movie (this i figured
>> out) and the resulation!!
>
> Can be as easy as a regex match for ".jpg" or
".mpg".
I thought so too, but then its not picking up the
normal image links
eg:
<img src=logo.jpg>
its only takeing the href image links
eg:
<a href="picture.jpg">
Another problem is I am not too good with REGEX (still
learning from php walkers)....
I know this is solveable as its working on someone
elses program...but just not able to work out the
logic for myself.
Ideas?
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!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php