user5995557
user5995557

Reputation:

Search bar mimicker

I'm not completely sure of how to gather search results from different search engines such as: amazon, target, Walmart, etc.

What I was aiming to create was a search bar that gathers, in general, a global search result from many sites.

If you take the site: http://www.kayak.com/ but for amazon, Walmart, etc.

I have the search bar set, though how would I go on about creating the retrieving the data portion.

body{
  padding-top: 75px;
}

.search-container{
  width: 490px;
  display: block;
  margin: 0 auto;
}

input#search-bar{
  margin: 0 auto;
  width: 100%;
  height: 45px;
  padding: 0 20px;
  font-size: 1rem;
  border: 1px solid #D0CFCE;
  outline: none;
  &:focus{
    border: 1px solid #008ABF;
    transition: 0.35s ease;
    color: #008ABF;
    &::-webkit-input-placeholder{
      transition: opacity 0.45s ease; 
  	  opacity: 0;
     }
    &::-moz-placeholder {
      transition: opacity 0.45s ease; 
  	  opacity: 0;
     }
    &:-ms-placeholder {
     transition: opacity 0.45s ease; 
  	 opacity: 0;
     }    
   }
 }

.search-icon{
  position: relative;
  float: right;
  width: 75px;
  height: 75px;
  top: -62px;
  right: -45px;
}
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Search</title>
<link rel="stylesheet" href="bar.css">
</head>
<body>
  <form class="search-container">
    <input type="text" id="search-bar" placeholder="What can I help you with today?">
    <a href="#"><img class="search-icon" src="http://www.endlessicons.com/wp-content/uploads/2012/12/search-icon.png"></a>
  </form>
</body>
</html>

After you search for like blue shoes, the result should display blue shoes in prices and rates (like trivago's style) in which I'm trying to work on. Again, I'm stuck on how to retrieve the actually information from the actual sites like amazon, Walmart, etc..

Thus, is there any way I can search through all of those site through this search bar, and retrieve the information back onto my site? Or a similar idea to this?

Upvotes: 0

Views: 68

Answers (1)

James
James

Reputation: 399

You need to use the APIs for the other services you mention. Some APIs will offer "wrappers", that is, some usable form of the API written in a particular language. For example, the Amazon API might have a PHP wrapper (I don't know for sure), which would give you some classes and/or functions to use that make the API calls for you.

When you set up the code that processes the search form, you'll have to feed that search query into each API you want to search with. They'll most likely return data in JSON or XML, so you parse through that to generate the search results.

Upvotes: 1

Related Questions