Help - Search - Members - Calendar
Full Version: Finding "http://" With Php Inside Code.
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
House
Hello my fellow Zymic lovers.

I have a problem, that i feel sure that you will be able to awnser for me. I have been struggling with how to do this for over an hour now so i have given up and resigned myself to getting flamed for being stupid.

To explain what i need help with, i will make an example:

QUOTE
"Tony was moderating his forums one day, and manually checking rapidshare links by copy and pasting them into rapidshare's own link checker and then seeing if they were valid. Tony was getting bored and really wanted to be able to just click one button on his website that would check to see if the rapidshare links on that page were valid. Now being the 1337 coder that Tony isen't he has access to all aspects of his website and web server, so it wasen't a problem with anything like that.

Tony got himself a little link checker, and that all went OK! The problem came when Tony was trying read the source of the post to get the links with PHP (delivered nicely too him by PHPBB3).

Tony's problem is that he can't think of a way to get each link individual link and put it into an array so that his link checker script can read them."


Now replace the name "Tony" with the name "Tom" and you've got my problem.

Any help lads would be highly appreciated. Hell i might even send you some monies if I have any lying around.

Regards

Tom
Ed
I think Tom might be after preg_match_all, a really simple example to get all the links:

CODE
<?php
$src = file_get_contents('sample.htm');

preg_match_all("#a href=\"(http:\/\/[^\"]+)#i", $src, $links);

foreach($links[1] as $link)
{
   echo 'Link : ', $link, "\n";
}
?>
Jetteh22
I'm not sure what you mean by this, what exactly you need help with.. Are you looking for it to do it automatically on each page load? Or are you looking for a program where you can insert text, and have it do it like that??

let me know and i'll work up a script for you.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.