Results 1 to 3 of 3

Thread: Related search terms issues

  1. #1
    Join Date
    Feb 2009
    Posts
    62
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Related search terms issues

    OK so I own a meta search engine.

    I have successfully obtained the correct code to get related search terms to list on my site from MSN Live.

    The code I am using is
    PHP Code:
    <?php 
    $html2 
    file_get_html("http://search.live.com/results.aspx?q=".$myurl); 
    foreach(
    $html2->find('div[class=qscolumn]') as $related
    foreach(
    $related->find('li') as $related2)

    if(
    $related2 == "" || (empty
    (
    $related2))) {echo 'No related search terms found.';}
    else {echo 
    '<a href="http://kywordpro.com/txt/1/10/' $related2->plaintext '.html">' $related2->plaintext '</a><br />';}    
    ?>
    The first problem I am having is when no related search terms are found its not puting 'No related search terms found.' on the site here is example page of this.

    The second problem is I need to replace all the spaces in the related search terms with "+" and remove the extra space at the end of the related search term.
    Here is a example page which shows actual related search terms.

    Thanks for any help I can get.
    Tim...

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I have the solution for your space problem, not the other one thought:
    PHP Code:
    <?php  
    $html2 
    file_get_html("http://search.live.com/results.aspx?q=".$myurl);  
    foreach(
    $html2->find('div[class=qscolumn]') as $related) {
      foreach(
    $related->find('li') as $related2) {
        if(empty(
    $related2)) {
          echo 
    'No related search terms found.';
        } else {
          echo 
    '<a href="http://kywordpro.com/txt/1/10/' str_replace(" ""+"trim($related2->plaintext)) . '.html">' trim($related2->plaintext) . '</a><br />';
        }
      }
    }
    ?>
    Last edited by Nile; 05-04-2009 at 05:58 PM.
    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    tgallagher26 (05-04-2009)

  4. #3
    Join Date
    Feb 2009
    Posts
    62
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    I am still having a problem when no related search terms are found its not puting 'No related search terms found.' on the site here is example page of this.

    If anyone has advice on fixing this I would be greatful.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •