Tuesday, October 26, 2010

Question-Answers Search Engine

  With the growing popularity of Yahoo! Answers more and more simalar websites are comming to the compete the niche. Yahoo! Answers not only provide newbies a facility to seek the experts' advice about a certain problem but it is a good way of marketing also. As I said earlier, there are now many simalar websites around but Yahoo! Answers and answers.com are leading ones. Both these websites provide RSS Feeds which can be used to make a kind of unique websites. This is what I have in my mind as I am writing this post. With the help of Feeds these websites offer we are going to make a question-answers search engine!
This will be an easy way to get regularly updated content and we can make money with Adsense. The search engines will also love our website as it will update regularly. So lets the ball rolling!
First, we need to write the code which will fetch results from answers.com. Note that I am not going to make a complete script for the search engine, instead I will only code the important part of our website such as how to fetch feed from Yahoo! and answers.com. At the end of the post you will find a list of recommended facilities which you can integrate to enhance the question-answers search engine.

  PHP code to fetch results from answers.com:

<?php
  $request = "http://wiki.answers.com/Q/Special:RSS&words=" . $_GET['keyword'] . "&answered=true";
  $response = file_get_contents($request);
  $xml = simplexml_load_string($response);
  echo "<h1>{$xml->channel->title}</h1>";
  foreach($xml->channel->item AS $qaItem)
  {
    echo "<a href=\"$qaItem->link\" title=\"\">$qaItem->title</a><br>";
    echo "<p>$qaItem->description</p><br><br>";
  }
?>

  The first line in the above code will fetch results from answers.com. As we have used the parameter answered=true it will only yeild questions which have been answered. Since we are making a search engine where people can find information about there problems and not a plateform where they can post there queries, using the answered=true parameter makes sense.
OK, now for Yahoo! answers results just replace the first line of code with http://answers.yahoo.com/rss/searchq?p=$_GET[keyword]&tab=1 so that:

   $request = "http://answers.yahoo.com/rss/searchq?p=" . $_GET['keyword'] . "&tab=1";

  While searching on internet i found another similar website offer RSS Feeds. The website is called ChaCha.

  $request = "http://www.chacha.com/search/feed.rss2?query=" . $_GET['keyword'];
 

  TODO:

  Write proper script for the search engine.
  Add rencently searched Tags for Search Engine Optimization.
  Add Paging for more than 10 results.
  cashe results for searches.

  Reference:

  http://wiki.answers.com/Q/How_can_you_turn_WikiAnswers_content_into_RSS_feeds_to_be_used_elsewhere_on_the_web
  http://www.squidoo.com/xml/syndicate_lens/yahoo-answers-rss-api
  http://developer.chacha.com

2 comments:

  1. AOL is a American company. it is developed in America and it provides online service provider. if u want help related AOL you can contact or AOL Tech Support number 1-844-3055-6556. we provides 24 hours free service for our customers you can also visit our official website AOL Tech Support Number click here. customers are god to us.

    ReplyDelete