Jump to content


Photo

Need string to read msn


  • Please log in to reply
2 replies to this topic

#1 seojunkie

seojunkie
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 14 September 2006 - 03:00 AM

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.

#2 Zane

Zane
  • Administrators
  • Advanced Member
  • 4,134 posts

Posted 14 September 2006 - 05:13 AM

do you have anymore code to show
like the one you're using to do this regex...
would help a lot more

btn_donate_SM.gif Want to thank me? Contribute to my PayPal piggy-bank
 

172938.png

#3 seojunkie

seojunkie
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 14 September 2006 - 01:46 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users