Jump to content

Need string to read msn


seojunkie

Recommended Posts

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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.