Jump to content


This topic is now archived and is closed to further replies.


Parsing a url for a given string

Recommended Posts

What is the most efficient way to parse a submitted url for a given string

I was thinking something along these lines but I’m not familiar with this sort of thing.

[code]$website = "http://www.justasign.com";
$clue="Sale sign displaying"

fopen($website, "r");

but then I got to thinking about buffer and timeout and thought I'll ask the experts..

[b]Background and why[/b]

I have this new website, it’s a lottery for websites where you win traffic as the prize

It works like this:

To enter the lottery you have to visit todays winning website and find the secret word using the clue:

Then you enter 
Todays secret word found on the winning webpage
Your website
A secret word from your content
And a clue (the 3 words before your secret word)

If you win then tomorrow everyone has to visit your website to find the secret word.

I am manually checking each entry for the clue and the secret word but I need to automate it somehow.

I’d like to run the code if fast enough at the point someone enters their website so I can error message them

If not I could loop through the entries and check them all prior to running the lottery.

Any help greatly appreciated


Share this post

Link to post
Share on other sites
Sorry to down harted but this is classed as a advanced topic.

i have inclueded how you get to match urls below and you should be able to work it out your self.

good luck.

remember that you have to crawl before you walk.





//$match_pattern = preg_quote(rtrim($your_link, "/"), "/");

//if ($handle = @fopen($remote_url, "r")) {

//while (!feof($handle)) {

//$part = fread($handle, 1024);

//if (preg_match("/<a(.*)href=[\"']".$match_pattern.

//"(\/?)[\"'](.*)>(.*)<\/a>/", $part)) {

//echo "links there";
// }

//} else{

//echo" no link sorry";



Share this post

Link to post
Share on other sites
I don’t think I explained it very clearly

If I had a url say “http://www.whatever.com/article.html”

and I wanted to know if the word “Fish” was in that webpage’s content

not the url name itself but the content on the page the url is pointing to.

Or am I missing the point? 

Share this post

Link to post
Share on other sites
i only managed to get a match from websites and sub url's i got no idear how to get a specific word fron another persons website.

sorry i tried that and really had a 14 hour go last week and no one could help me on here so i gave up.

hope you get it good luck.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.