seojunkie Posted September 14, 2006 Share Posted September 14, 2006 I'm trying to write a script that will read in a search page from msn and find the index position of a given site. The code works except for one condition of the search.MSN lists the results in two ways:- If the searched for phase is in the domain name, then the parts of the url containing the search phase is enclosed in <strong> tags. So if I did a search for the word cars and my url was www.bestcars.com, the code on MSN would appear as<li class="first">www.best<strong>cars</strong>.com</li>- if the searched for phase is not in the url, say ties, then the result appears as <li class="first">www.bestcars.com</li>The problem is with the second type. Sometimes the found url will contain something after the .com, like:<li class="first">www.bestcars.com/index.php?cPath=35</li>I have tried an expresion like this to find that but I can't get it to work:<li class="first">www.bestcars.com(.*)</li>I also tried<li class="first">www.bestcars.com^(.*)$</li>Does anyone have any idea on what is needed to get this to work. I would appreciate any suggestions. Quote Link to comment Share on other sites More sharing options...
Zane Posted September 14, 2006 Share Posted September 14, 2006 do you have anymore code to showlike the one you're using to do this regex...would help a lot more Quote Link to comment Share on other sites More sharing options...
seojunkie Posted September 14, 2006 Author Share Posted September 14, 2006 The following is the relevant code, I think.$conditions = sprintf("<li class=\"first\">%s(.*)</li>", $tmpurl); $file = fopen($filename, "r");if ($file) { while (!feof($file)) { $var = fgets($file, 1024); if (eregi($conditions,$var,$out))After the above, $out should contain the found entries but doesn't. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.